Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
XML RSS Feed
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleReset a DataGrid control when the data to which it is bound changes in VB .NET
KeywordsDataGrid, database, VB.NET
CategoriesControls, VB.NET, Database
 
If the database's data has changed, you need to reload the DataGrid control to display the new data.

First, clear the DataSet to remove old data. If you don't do this, reloading the DataSet will merge changes made to the DataSet's data with the newly loaded data.

Next refill the DataSet. Then call the DataGrid control's ResetBindings method.

 
dsUsers.Clear()             ' Remove the old data.
daUsers.Fill(dsUsers)       ' Reload the data.
DataGrid1.ResetBindings()   ' Redisplay the data.
 
For lots more information on database programming in VB .NET, see my book Visual Basic .NET Database Programming.
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated