Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

About textbox Validating, Validated & TextChanged

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steven Spits - 10 Feb 2006 08:25 GMT
Hi,

I have a textbox that should be numeric, so I've written some code in the
Validating event. When the text was changed (and if it's valid!), I need to
compute some other values. I've done this in the Validated event.

However, when the users tabs over that field, the Validating & Validated
event is triggered even if nothing changed.

I've solved this by setting textbox.Tag to false in the Enter event. In the
TextChanged event the tag is set to true and in the Validated event I only
run the code if the tag is true.

Isn't there a better way? Some .IsDirty property?

Steven

- - -
Dmytro Lapshyn [MVP] - 10 Feb 2006 11:23 GMT
Hi Steven,

I think your approach is quite fine. There is no out-of-the-box approach to
check whether a textbox is "dirty". However, with your approach, the user
might have edited the value and then reverted it back, but you mark the text
box as dirty upon the first change. Might be better to remember the original
value on Enter and then compare it with the current one upon Validating.

> Hi,
>
[quoted text clipped - 14 lines]
>
> - - -

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.