Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. A question abt master detail forms

A question abt master detail forms

Scheduled Pinned Locked Moved C#
csharpwinformstutorialquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rocky
    wrote on last edited by
    #1

    hello every one, well I'm working on making a master detail form here. I've binded the data correctly and now I want to add the update, del, and insert new record functionality to the detail form. I'm using .net 2.0 C# and I'm working in windows Forms. I've used DataGridView class to display the detail data information. For saving the record, I wanted to cast the datasource of DataGridView into a datatable first and then use it to iterate thru the data but it returns a null so I get the nullreferenceException. Plz tell me how to iterate thru the detail table here. I actually deleted a few columns from the detail table ;like the PK columns and Foreign Key columns coz the user doesnt need to see those. But I do wanna have access to those esp when updatin the record. So what can I do. if its possible plz give me a sample code or application if u can. thanks in advance... Rocky

    I 1 Reply Last reply
    0
    • R Rocky

      hello every one, well I'm working on making a master detail form here. I've binded the data correctly and now I want to add the update, del, and insert new record functionality to the detail form. I'm using .net 2.0 C# and I'm working in windows Forms. I've used DataGridView class to display the detail data information. For saving the record, I wanted to cast the datasource of DataGridView into a datatable first and then use it to iterate thru the data but it returns a null so I get the nullreferenceException. Plz tell me how to iterate thru the detail table here. I actually deleted a few columns from the detail table ;like the PK columns and Foreign Key columns coz the user doesnt need to see those. But I do wanna have access to those esp when updatin the record. So what can I do. if its possible plz give me a sample code or application if u can. thanks in advance... Rocky

      I Offline
      I Offline
      Itanium
      wrote on last edited by
      #2

      You have to add both the tables in a dataset and then add realtionship to the priamry and foreign keys of these tables in DataSet.Relations. 2nd thing, dont delete those colunms, just make them invisble to user or make them read only.

      sorry for my bad English.

      R 1 Reply Last reply
      0
      • I Itanium

        You have to add both the tables in a dataset and then add realtionship to the priamry and foreign keys of these tables in DataSet.Relations. 2nd thing, dont delete those colunms, just make them invisble to user or make them read only.

        sorry for my bad English.

        R Offline
        R Offline
        Rocky
        wrote on last edited by
        #3

        thanks alot, I've almost managed that by now. and I deleted those columns as well. now theres only onw nullreference Exception left. I'll deal with that pretty soon as well. thanks

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups