Search Wiki:
Resource Page Description
This sample shows how to edit data from a DataGridView in a details form which opens when one double clicks on the RowHeader of the DataGridView. Since both forms are bound to the same datasource one sees an instant update on both forms when the user decides to save the data and additional roundtrips to the database are avoided. It also provides a brief introduction to DataBinding in .NET.

EditDetailsForm.png

Additional Resources
Connecting to Data in Visual Studio
Getting Started with Data Access
Windows Forms Data Binding
Forms over Data Video Series

Prerequisites
The examples were created using Visual Basic 2008 Express (free download)/Visual C# 2008 Express (free download) but do also apply to earlier versions of Visual Studio (with minor modifications).


Enjoy!

Daniel
my blog
my code samples

P.S.: Please let me mw know if this code was helpful or not. If not, I’d appreciate if you could tell me what you were expecting. Thanks very much!
Last edited Sep 15 2009 at 4:37 AM  by Daniel_Walzenbach, version 11
Comments
asimze wrote  Sep 18 2009 at 11:22 AM  
Danijel,
What is Datasource is diferent and You have only same Id on both datasource.How to do it?

Daniel_Walzenbach wrote  Oct 12 2009 at 9:38 PM  
asimze, I'm not quite sure that I understand your question... Could you help me be rephrasing it? Thanks!

lexxkrt wrote  Oct 26 2009 at 2:09 PM  
If I change the value, but don't click save, and just close the window. The values in the Binding changed.

attacker8x wrote  Nov 4 2009 at 1:52 PM  
vWhen i axtract have a error "Could not be creat Querry service for...."How do i?

Daniel_Walzenbach wrote  Dec 17 2009 at 3:18 AM  
Hi lexxkrt,

what you'd need to do is to handle the FormClosing event of the OrderDetails form and undo the modifications to the DataSource using the RejectChanges method of the dataset. I updated the code (both VB.NET and C#). Does this work for you?

Enjoy!

Daniel

Updating...
Page view tracker