Is there a method to change a text box back to it's original state?
-
I'm programming in C# but I thought this would be a VB question i'm not sure how to do this, but assume I've got a text box that has a properties. The properties dynamically change throughout the program, upon request, is there a method through system way to get the text box (or any checkbox, radio button group, label etc.) to change back to its original state?
-
I'm programming in C# but I thought this would be a VB question i'm not sure how to do this, but assume I've got a text box that has a properties. The properties dynamically change throughout the program, upon request, is there a method through system way to get the text box (or any checkbox, radio button group, label etc.) to change back to its original state?
No. The controls do not keep a record of their initial state are application startup. You have to write a method that will reset all the properties of a control to a state that you want. Call this method when you want to reset the textbox.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
I'm programming in C# but I thought this would be a VB question i'm not sure how to do this, but assume I've got a text box that has a properties. The properties dynamically change throughout the program, upon request, is there a method through system way to get the text box (or any checkbox, radio button group, label etc.) to change back to its original state?
Hi, alternatively you can hide the original Control, then call an "init" method, which clones the Control, adds it to its parents.Controls and makes it visible. When you want the original back, remove the Clone, and call "init" again. So it is always a clone that is shown, gets modified, and the original is never touched. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, alternatively you can hide the original Control, then call an "init" method, which clones the Control, adds it to its parents.Controls and makes it visible. When you want the original back, remove the Clone, and call "init" again. So it is always a clone that is shown, gets modified, and the original is never touched. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
Though I've never had to reset controls back to a known state, (I tend to destroy and create entire forms instead) that's a trick I'll have to put in the bag.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Though I've never had to reset controls back to a known state, (I tend to destroy and create entire forms instead) that's a trick I'll have to put in the bag.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007I made sure my bag of tricks is an ArrayList, so it accepts all kinds of objects, and is only limited by total amount of memory available. :-D Come to think of it, it more resembles a Heap, difficult to enumerate...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
I made sure my bag of tricks is an ArrayList, so it accepts all kinds of objects, and is only limited by total amount of memory available. :-D Come to think of it, it more resembles a Heap, difficult to enumerate...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
Yeah, same with mine. Well, not really a digital heap, but a huge pile of sticky notes. :-D
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007