Windows Develop Bookmark and Share   
 index > Windows Forms General > Parent and child datagridview question
 

Parent and child datagridview question

In a VB.Net Windows form, I have two datagridview control with a parent and child relationship. Value from two columns at the parent control is used to filter the dataset for the child control. I apply the two events on the parent control, cell click (for the mouse user) and selection change (for the keybroad user), to fill the datatable on the child control. However it breaks when FIRST open the form on the "selection change" event and it complains about the "Null reference on the value I try to pass to the child control". My guess is that when the parent control first activate and there is no data on the control (I know for sure the dataset has data for the parent control when the datatable is filled), so how do I put a "If" statement to bypass this. The value I pass to the child control are the primary key and a datatime field on the parent control dataset.
pmak  Saturday, May 09, 2009 2:08 PM
Please post the relevant code, it will make it easier for us to make a suggestion. Thanks!
~~Bonnie Berent [C# MVP]
BonnieB  Sunday, May 10, 2009 5:59 PM
Are you using a binding source at all? Or are you data binding the datagridviews to the data tables or datasets directly?

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Sunday, May 10, 2009 6:04 PM
We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please follow up this thread. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Friday, May 15, 2009 7:42 AM

You can use google to search for other answers

Custom Search

More Threads

• ActiveX register problem?
• Hiding the Selected Row/Cell in a DataGridView
• Do something after ShowDialog
• Design-Time Attribute for a Font Array in Visual Studio 2005
• Delayed Sending of an Email
• TabControl: Cancel Validating causes buttons on the tab page not responding to click event
• Printing on dot matrix printer using ReportViewer
• question about color of tab
• Closing ChildForm in an MDI Application
• modify highlighing behavior of textbox