470,620 Members | 1,460 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,620 developers. It's quick & easy.

Datagrid Refresh problem

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
Nov 21 '05 #1
2 4407
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.
--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Dan" <da*************@gmail.com> wrote in message
news:64**************************@posting.google.c om...
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

Nov 21 '05 #2
Dan,
Solution 1: Get BindingManagerBase from dataGrid.BindingContext Property,
call BindingManagerBase.EndCurrentEdit Method.

Solution 2:
"Dan" wrote: 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
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jeff | last post: by
3 posts views Thread by Matthew Woods | last post: by
3 posts views Thread by Jim Heavey | last post: by
8 posts views Thread by Inigo Jimenez | last post: by
3 posts views Thread by james crosthwaite via .NET 247 | last post: by
1 post views Thread by Andre | last post: by
7 posts views Thread by Juan Romero | last post: by
1 post views Thread by Kevin Hodgson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.