isDirty

  • Thread starter Thread starter Arne Garvander
  • Start date Start date
A

Arne Garvander

Does a windows textbox have a property that tells if the user has entered
anything into a textbox on a windows.
 
Yes, the text property. If it's not equal to an empty string (<> "") it has
data in it. Or you can look at the length property to see if it has a
length of zero (indicating it's empty).

-Scott
 
I use the text to preset a default value, so that idea does not work for me.
There is a modified property that I can use, but it is not reliable.

--
Arne Garvander
Certified Geek
Professional Data Dude


Scott M. said:
Yes, the text property. If it's not equal to an empty string (<> "") it has
data in it. Or you can look at the length property to see if it has a
length of zero (indicating it's empty).

-Scott
 
Hi

You could use the TextChanged Event, add an eventhandler and you get all
changes in the textbox.


Arne Garvander said:
I use the text to preset a default value, so that idea does not work for
me.
There is a modified property that I can use, but it is not reliable.
 
That does not work for me.
I need to check up on the whole form when they click the save button.
 
Subclass your textboxes, create a property called IsDirty, set the property
to True the first time the text change event is fired (you could even make
it a little smarter by recording the default value, to compare to see if the
value was changed back to the default and then set the IsDirty flag to
false).

Then, either keep a collection at the form level of all these textboxes so
you can enumerate them quite seemlessly, and check the IsDirty property in
succession on each control, or just enumerate all controls on the form and
check for a control of type equal to your text box subclass (the former is
more efficient), and check the IsDirty property.


Jediah L.
 
If you have a default value, then just check the text property to see if the
text is NOT the default value.


Arne Garvander said:
I use the text to preset a default value, so that idea does not work for
me.
There is a modified property that I can use, but it is not reliable.
 
That is an interesting idea.
Microsoft already has a property for that.It is called Modified.
That flags works well unless I reformat what the operator entered.
myPhone.text = PhoneFormat(myPhone.text) will loose the proper value of the
Modified property.
 
Back
Top