Newbie asks about DataSet HasChanges

  • Thread starter Thread starter Mika M
  • Start date Start date
M

Mika M

Hello!

My application has MainMenu containing MenuItem 'mnuSave' and ToolBar
containing ToolBarButton 'tbbSave'.

When users has edited DataGrid or any of the TextBoxes on the windows form,
then ds.HasChanges (ds=DataSet) will be 'True', then I want set ...

mnuSave.Enabled = ds.HasChanges
tbbSave.Enabled = ds.HasChanges

.... automatically because these (mnuSave and tbbSave) are not enabled when
ds.HasChanges = False.

.... and finally when mnuSave or tbbSave is pressed and changes saved into
database tables then ds.HasChanges will be 'False', mnuSave and tbbSave
should be not Enabled again.

How to notice when ds.HasChanges state will change and do this
automatically? I think it should be captured somehow using EventHandler
(AddHendler) or something, but don't know how yet.
 
Hi Mika,

The only problem you have I think is, that the dataset can have changes in
some cases when the endcurrentedit is done and that is in a lot of cases
either by changing the rowposition or by doing the instruction
endcurrentedit, for which you need something as an extra button.

And that it set to false by either commands as reject, update or
acceptchanges.

There is a greath song as record from Harry Belefonte about this.

The tittle is I thought There is a hole in the bucket.

Just my thought although I hope it helps anyway.


Cor
 
Back
Top