ant
June 18th, 2001, 02:55 PM
how do you clear all the user made changes on a form. Like when the user checks a check box the next time they get that form that checkbox shouldn't still be checked. I've tried Form2.refresh but that doesn't do anything
--Ant
--------------------------------------------------
check out my newest freeware
E-mail me at: cgeorge@thevortex.com
for the address
Ghost308
June 18th, 2001, 03:03 PM
Are you using Form1.Show to display your form and Hide to make it disappear? The Show method automatically invokes the Load method/event, the Hide method does not invoke the Unload method/event. Try using Unload to make your window go away, that way when it is displayed again it is re-loaded into memory and (i think...) should use its default settings.
Cimperiali
June 19th, 2001, 10:59 AM
Another way is to write a sub to reset your fields (it should be quicker than unloading and reloading the form):
ie:
inside a form
public sub resetMe()
'you may cycle throughout all controls
'with
'dim fMe as form
'dim ctl as control
'set fMe = thisformname
'for each ctl in fMe
'if typeOf ctl is checkbox then
'ctl.checked = false
'elseif
'...
'else
'...
'end if
'next ctl
'Or you may want to use specific code:
Check1.Value = false
Text1.Text = ""
'...
end sub
To call this "strange" sub, you type the name of form, type a point and...look: it is a method of the form, now!
ie:
Form1.resetMe
'or
with Form1
.resetMe
end with
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.