Hi Sanddevil,
> Hi there - I hope someone out there can help me! I'm using a .Net DataGrid
> Class to show the results of a SQL query in a spreadsheet type control.
[quoted text clipped - 24 lines]
> Any
> help will be most appreciated!
Although I'm not sure, I think "Invalidate" method could do that. What I
also think is that there is probably still a better way, but I never did
what you do. Invalidate actually forces the control to repaint itself.
Another thing I haven't tested but that might work, is to use the
SuspendBinding and ResumeBinding methods of the BindingManager of your grid.
Call SuspendBinding before modifying the DataSet and ResumeBinding after
that. You can retrieve the BindingManager using the BindingContext property
of your DataGrid:
BindingManagerBase bm;
bm = dataGrid.BindingContext[ dataGrid.DataSource,
dataGrid.DataMember ];
bm.SuspendBinding();
// update data
bm.ResumeBinding();
An interesting FAQ that might help you further is
http://msdn.microsoft.com/smartclient/community/wffaq/default.aspx (main
page)
and in specific
http://msdn.microsoft.com/smartclient/community/wffaq/ctrlsp.aspx
Kind regards,
Tom T.
TT \(Tom Tempelaere\) - 01 May 2005 10:15 GMT
"TT (Tom Tempelaere)" </\/_0_$P@/\/\titi____AThotmailD.Tcom/\/\@P$_0_/\/>
schreef in bericht news:p31de.78253$mZ.5067907@phobos.telenet-ops.be...
[...]
> Another thing I haven't tested but that might work, is to use the
> SuspendBinding and ResumeBinding methods of the BindingManager of your
[quoted text clipped - 8 lines]
> // update data
> bm.ResumeBinding();
[...]
This example uses C#, just to mention... But it should be similar in MC++
TT
Sanddevil - 01 May 2005 11:37 GMT
Hi Tom - many thanks for taking the trouble to respond to me. It was much
appreciated, and your suggestion worked!
The syntax was a little tricky in C++, so for the benfit of anyone stumbling
upon this in the future:
BindingManagerBase* pBm;
pBm = dataGrid1->BindingContext->Item[dataGrid1->DataSource,
dataGrid1->DataMember];
pBm->SuspendBinding();
// Do your updates to the underlying database here
pBm->ResumeBinding();
Many thanks again.
Cheers
Sanddevil
"TT (Tom Tempelaere)" </\/_0_$P@/\/\titi____AThotmailD.Tcom/\/\@P$_0_/\/>
wrote in message news:471de.78259$G6.5045284@phobos.telenet-ops.be...
> "TT (Tom Tempelaere)" </\/_0_$P@/\/\titi____AThotmailD.Tcom/\/\@P$_0_/\/>
> schreef in bericht news:p31de.78253$mZ.5067907@phobos.telenet-ops.be...
[quoted text clipped - 16 lines]
>
> TT
TT \(Tom Tempelaere\) - 01 May 2005 15:08 GMT
Way to go Sanddevil...
TT
> Hi Tom - many thanks for taking the trouble to respond to me. It was much
> appreciated, and your suggestion worked!
[quoted text clipped - 43 lines]
>>
>> TT
Sanddevil - 02 May 2005 10:21 GMT
In fact, I've come across another solution which I'll preserve here for
prosterity in case others need it.
This solution involves clearing the dataset and then reloading it. No
performance issues either - on my creaky old laptop it is a blink of an eye.
// Load the grid
iRowCount = oleDbDataAdapter1->Fill(dataSet1);
dataGrid1->DataSource = dataSet1->Tables->Item[0]->DefaultView;
// add / amend rows in the underlying database elsewhere in the code
// update the screen
dataSet1->Clear();
iRowCount = oleDbDataAdapter1->Fill(dataSet1);
Cheers
Sanddevil
"TT (Tom Tempelaere)" </\/_0_$P@/\/\titi____AThotmailD.Tcom/\/\@P$_0_/\/>
wrote in message news:Ap5de.78480$vm1.5084170@phobos.telenet-ops.be...
> Way to go Sanddevil...
>
> TT