|
-
Jan 12th, 2000, 11:45 PM
#1
Thread Starter
Lively Member
Hi.
My program has two Forms. Choosing an option on Form1 brings up Form2. When I go to the second Form, enter some data and click "Cancel", I go back to the first Form with "Me.Hide" and "Form1.Show".
However, when I go Form2 again, all of the values that were entered previously are still there. I want the controls to reset to their default value when I click "Cancel" on Form2. In other words, I want the controls to have the values that they would have if I was opening the Form for the first time.
I know that I can reset the value for each control individually upon clicking "Cancel", but I was wondering if there was an easier way to do this. Any suggestions?
Thanks.
Chris
-
Jan 12th, 2000, 11:56 PM
#2
Hyperactive Member
I would throw into a Clear function code to reset each control
id:
txtText1.text = ""
txtText2.text = ""
something like that and then call that function either when you click the cancel button or whenever you goto the form
[This message has been edited by netSurfer (edited 01-13-2000).]
-
Jan 13th, 2000, 12:02 PM
#3
Why don't you just unload Form2, then when you reload it the values will be Reset.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 13th, 2000, 12:04 PM
#4
Hyperactive Member
This isn't the exact syntax, but isn't there a generic way to enumerate the controls like:
Code:
For Each Control In Controls
If Control Is TextBox Then
Control.Text = ""
End If
Next
Regards,
Wade
-
Jan 13th, 2000, 12:11 PM
#5
Thread Starter
Lively Member
Thanks netSurfer, Aaron and WadeD.
Of the 3 options you all provided, Aaron's was the easiest to implement (and the one that I was looking for actually).
I know that this was a simple one but I'm sick and the ol' brain isn't working so well right now (e.g., I tried to do a Me.Unload rather than Unload Me before starting this thread!). I'm feeling a little lazy too.... .
Thanks again,
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|