Changes

Jump to: navigation, search

Visual Basic and the DataGridView Control

746 bytes added, 15:11, 10 August 2007
Adding a DataGridView Control
[[Image:vb_datagridview_running.jpg]]
 
== Saving Changes to a DataGridView ==
 
It is important to realize that when changes are made in a DataGridView control the chanes are only made to the DataSet and are not written back to the database. In order for the data changes to be stored back to the database an additional step is needed.
 
Extend the above example to add a Button control. Once the Button has been added, double click on it to view the code for the ''Click'' code procedure and edit the code so that it appears as follows:
 
<pre>
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
 
Me.CustomersTableAdapter.Update(Me.NorthwindDataSet)
 
Me.NorthwindDataSet.AcceptChanges()
 
End Sub
 
</pre>
== Customizing the DataGridView Control ==

Navigation menu