Hi All,

I'm very new to Delphi and I'm stuck with this (hopefully very basic) question.

How do you reset a form when it's closed?

I have 2 forms, say "form1" and "form2", when you click a button on form1 it opens form2 via form2.ShowModal; on form2 you input data, save it and then closes the form bringing them back to form1.

Only problem is, when you click the button to open form2 again the data entered last time is still there. If form2 only had a couple of components that would be fine, I'd reset them manually on close... but it doesn't, it has loads of checkboxes, input boxes, combo boxes, list boxes, etc. So it isn't really practical to even loop through the componentlist and reset values.

Is there a function to do this for you? If not could somebody suggest the best solution?

Thanks in advance!

Normal coding practice would be make the form for when you want it, and then free it - as a result next time you make it, it will be as it was in the beginning.

Otherwise you need to make a reset function on the form that puts everything back.

This question has already been answered. Start a new discussion instead.