Question Form does not open correctly on second instance

.netHead

New member
Joined
Nov 13, 2010
Messages
4
Programming Experience
1-3
Hello All, I have a question that I hope to find a much more simpler solution to.

I have two forms in my program which are named Main and Second. The Second form has several textboxs, buttons (some disabled) and comboboxes. When the Second form is opened via the Main form on the very first instance, everything works fine.

However, if I re-open the Second form after previously closing it, the disabled buttons are no longer disabled and the text controls and comboboxes show the previous values entered from the first instance which I do not want. How can I ensure that the Second form will be opened "clean" every time.

Currently I have to add instances to the onload event to do this to ensure that the form is cleared on the second instance.
textbox1.text = ""
textbox2.text = ""
textbox3.text = ""
button1.enabled = False

Thank you very much for any responses.
 
How are you opening the 2nd form? Are you creating and showing a new instance each time or are you using the built in default instance?
 
Hi, Thanks for the reply.

A button on the Main form contains the code to open the Second Form. I believe that is the default instance, yes?

SecondFrm.Show()
 
Back
Top