PC Review


Reply
Thread Tools Rate Thread

Datagrid Refresh problem

 
 
Dan
Guest
Posts: n/a
 
      25th Nov 2004
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
 
Reply With Quote
 
 
 
 
Manohar Kamath
Guest
Posts: n/a
 
      25th Nov 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?UnVsaW4gSG9uZw==?=
Guest
Posts: n/a
 
      25th Nov 2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: DataGrid refresh problem Ken Tucker [MVP] Microsoft VB .NET 1 11th Nov 2005 02:19 AM
DataGrid Refresh problem Paperback Writer Microsoft ASP .NET 0 9th Jun 2005 10:34 PM
DataGrid Refresh problem James Microsoft C# .NET 1 21st Jun 2004 03:36 PM
DataGrid Refresh problem James Microsoft Dot NET Framework Forms 0 21st Jun 2004 09:24 AM
Datagrid Refresh Problem copyco Microsoft ADO .NET 3 9th Jul 2003 05:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:06 AM.