Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid update 2

Status
Not open for further replies.

kevinf2349

Technical User
Sep 12, 2002
367
US
I have a datagrid that gets built on the fly and then displayed. I need to be able to update and display the updates at set intervals. So far I can build the dtatagrid and I am fairly sure that the update parts works but I can't get it to display the 'new' datagrid. I did some searching and found mention of needing to rebind?

Is this indeed what I need to do, if so, how do I do it. The example Bind that I found online doesn't work.

All help gratefully appreciated
 
You were not very specific. But in any case, what I assume you are doing is refilling your DataTable or DataSet at specific periods of time. What you will want to do after this is a:

DataGrid.DataBinding.Clear()
DataGrid.DataSource = YourDataSource
etc....
 
RiverGuy

Thanks for the pointer. You assume correctly, I am wanting to refresh the screen at specific intervals.

Thanks again
 
It's hard to tell w/o your code posted. Basically, some pseudocode would be as follows:

Sub RefreshData()
Clear DataSet/DataTable
Fill DataSet/DataTable
Clear DataGrid DataBindings
Set DataGrid DataSource
End Sub
 
Why don't you use a timer control to update the grid ?
 
I am doing, but the update wasn't being shown, just the old datagrid. :(
 
Well i suggest first try only to clear the grid and see if that works.
 
Try this:

DataSet1.Clear() 'clear the dataset


Then depending on what type of connection you are using:

OleDbDataAdapter1.Fill(DataSet1) ' refill DataAdapter1
OR
SqlDataAdapter.Fill(DataSet1) ' refill SqlDataAdapter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top