190 likes | 351 Views
Visual Studio 2005 Using the DataGridView Control. V. Matos Cleveland State University. Create Windows Project: WinDB_Demo_01. Main menu: Data | Add New Data source …. Select: Database and click on Next. Select existing DB connection (or create a new one).
E N D
Visual Studio 2005Using the DataGridView Control V. Matos Cleveland State University
VB project now contains a local DataSet reflecting the image of selected database objects
Choose Data Source from the current Project’s DataSet selection
Add a BindingNavigator control to allow motion and maintenace on the DataView
Click on the BindingNavigator control. Modify its Property page (Associate the DEPARTMENTBindingSource with the BindingNavigator)
Double-click on the SAVE icon and insert the following VB code Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click Me.Validate() If (Me.CompanyDataSet.HasChanges) Then Me.DEPARTMENTBindingSource.EndEdit() Me.DEPARTMENTTableAdapter.Update(Me.CompanyDataSet.DEPARTMENT) End If End Sub