Microsoft.com
All DevCenters
MSDN Home
MSDN Code Gallery:
Code Gallery Home
|
Browse Gallery
|
Share Code
|
Help and FAQs
How do I edit tabular data/data in a DataGridView in a details form?
Home
Downloads
Discussions
People
License
Close
RSS
All Resource Updates
Discussions
Releases
Wiki
RSS
Comments
|
Print
|
Page Info
|
Change History (all pages)
Search Wiki:
Home
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.
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
Sign in to add a comment
Current Release
HDI edit tabular data ...
Thu Sep 3 2009 at 7:00 AM
More Tags ...
Popular Tags
.NET
.NET 2.0
.NET 3.0
.NET 3.5
.NET Framework
2008
2009
ADO.NET
ASP.NET
C#
C# 3.0
C++
CRM
Dynamics
Entity Framework
Hotfix
LINQ
LINQ to SQL
MCMS
MSCRM
MSDN Magazine
Placeholder Controls
Samples
SharePoint
silverlight
SQL Server
tfs
Tools
VB.NET
Visual Basic
Visual C#
Visual Studio
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
VS SDK
VSTO
VSX
WCF
Windows Forms
Windows Mobile
WPF
Manage Your Profile
Legal
Contact Us
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.
Terms of Use
Trademarks
Privacy Statement
Updating...