Display save indicator after textbox modified

FreeriderUK

Well-known member
Joined
Jun 27, 2006
Messages
100
Location
London
Programming Experience
10+
Hi all - I think this is the right place for this...

I would like to add some kind of indicator to show data has changed in MyDataset, so the user knows they need to click the save button to update the database.

I'm using a number of bound textboxes on a Windows Form and have tried putting this code in the CustomerNameTextBox.Leave event:

If MyCustomersDataSet.HasChanges = True Then
Me.Text="Data Changed"
End If

but the HasChanges thing doesn't seem to be working - it doesn't detect the change.

I must be missing something here. I thought that when you change the text in a databound textbox, it was changing the data in the dataset.:confused:

Or, is there another way of doing this?
 
Thanks for your help cjard.

...dont spend hours on this trivial little bit of functionality...
:D

I'm writing this application in my spare time, so it's not costing me anything. And *I* think it's :cool: - If I hadn't decided to do it, I would probably not have learnt the connection between HasChanges and Validate/EndEdit.

I'm using similar code to that which you suggested but putting in the Textbox Leave event and it works as I expected.

Thanks again for all your help.
 
No probs.. just remember that though we do validate upon every leave (the user cannot leave the textbox if validation fails), we dont typically endedit upon every leave. It probably wont cause an issue in most contexts, but if you experience interruptions to your ui or data behaviour oddities, look to this first; theres a reason why microsoft dont do it as often as validation.
 
Back
Top