Green at Data Grids

runswithsizzors

Well-known member
Joined
May 11, 2005
Messages
70
Location
Northern Michigan
Programming Experience
5-10
Yeah I am new at using these data grids in VB.Net, (*Whsipering*: Personally I like the one in Delphi) But I am bound and determine to learn this but running in to some problems. I created a procedure to refresh the data grid any time an update/insert/delete is done to the database. Just a simple access database.

When I refresh the grid the old information is still there and the new information is appended to the bottom. Can anyone tell me how to clear the data grid then add the new information to the grid.

Here is my sub
Dim ADOData As New OleDb.OleDbDataAdapter("Select * From Users", ADOConnection)

ADOData.Fill(ADODataSet, "Users")
DataGrid1.DataSource = ADODataSet
DataGrid1.DataMember = "Users"

I handle the opening and closing of everything in other buttons but I fire this off after the add/update/delete button and when I open a different database.

Any suggestions, or am I just clueless. Thanks all!
 
To answer your first post, clear the dataSet before filling it again. Use ADODataSet.Clear

To use textBoxs to edit the info in the datagrid, use dataBindings. If you bind the textboxes to the same dataView as the dataGrid, when you change the active row of the datagrid, the textboxs will reflect the same data and when you make edits to the textboxs, the datagrid will reflect those changes.
 
Back
Top