Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need a reliable way to set Save/Cancel button status
Message
From
08/05/2003 10:52:49
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00785839
Message ID:
00786253
Views:
21
Don,

Yeah, I don't know if I would try putting an .EndEdit() in a KeyPress event either. You could do the button enabling in the Validate of your objects, but since that's really not how you wanted it to work, I'd say forget it and just keep the buttons enabled. I can't think of an easy way off the top of my head to do what you want done. Maybe someone else might have some ideas...

~~Bonnie



>Bonnie,
>
>.EndEdit does handle the ds.HasChanges issue. Thank you.
>
>I was trying to get a "Live" activation of the button as the user typed. For example he changes one letter in a text field and the button becomes enabled. Using .EndEdit in the Keypress event for each keystroke leads to it's own issues.
>
>So for now I am not going to do "live" button enabling (at least until I am more expert). I will simply use buttons that are always active.
>
>>Don,
>>
>>Your original idea (checking the ds.HasChanges()) will work ... the reason that you found that changes to bound textboxes don't always show up as being changed is because you need to do an EndEdit() on the row (syntax is something like ds.Tables[0].Rows[0].EndEdit()). Then ds.HasChanges() will correctly return True.
>>
>>~~Bonnie
>>
>>>I want to find a reliable method for enabling/disabling the buttons based on changes made to a VB.Net form. This was simple in VFP using InteractiveChange() event to set a "changed" status to .T. and enable the buttons.
>>>
>>>In .Net I'm getting into way too much complexity so I wanted to see if there is a "Best Practice" or simple method for this that I have missed.
>>>
>>>Originally I tried checking the Dataset.HasChanges property but I found I could make changes to a bound textbox and HasChanges return False. So then I started using events such as textbox.Keypress, checkbox.CheckStateChanged, etc. to track changes but there are lots of factors I am having to work around in doing this (Such as "Delete" key is not tracked in Keypess() and many other such oddities). My workaround code is growing larger and more complex, so I figure it's time to check in here and get some advice!
>>>
>>>So - has anyone worked out a simple and reliable method for Enabling/Disabling and options? Is there a recommended technique for this I am missing?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform