Datagrid Refresh problem

D

Dan

Hi,

I have a Datagrid in a simple form that I programmatically modify
using something like that :

Me.DataGrid1(RowID, ColID) = "blablabla"

But my cell wont refresh unless I click on another cell or move the
scrollbar of the datagrid... :(

I tried everything : .Update, .Refresh, .Invalidate, etc...

How can I refresh it?

Thanks

Daniel
 
M

Manohar Kamath

Dan,

Programmatically, I would change the data in the datasource that binds to
the control, and do a "Refresh()". From a UI point of view, this is
equivalent to going to a cell, changing the data and clicking outside of the
cell. The cell is not considered changed until you move out of it.

Simply:

DG1.DataSource = dataSet1.Tables["foobar"]

....

' Change the data in the dataset
....

' Refresh the data in the datagrid
dataSet1.Refresh

Hope that helps.
 
G

Guest

Dan,
Solution 1: Get BindingManagerBase from dataGrid.BindingContext Property,
call BindingManagerBase.EndCurrentEdit Method.

Solution 2:
: DO NOT use Me.DataGrid1(RowID, ColID) = "blablabla". Set the
value directly to DataTable or DataView which you are bound to DataGrid.

Good Luck.

Rulin Hong
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top