Reset a form?

  • Thread starter Thread starter Martin Williams
  • Start date Start date
M

Martin Williams

If you have a form with multiple controls e.g. radio buttons, checkboxes,
etc., is there a way that you can reset the entire form to its original
state, other than setting an instance of the form to "Nothing" then
redeclaring it? Thanks.
 
You may use a For Each.. statement to loop/reset the controls on the form.
 
The best way to do this is to make an Initization function that you call
from Sub New. Put in there all the code to load the form insted of doing it
through the designer (which puts in into InitializeComponent). Then you
will have a function you can call to reset your own form.

Chris
 
Martin Williams said:
If you have a form with multiple controls e.g. radio buttons, checkboxes,
etc., is there a way that you can reset the entire form to its original
state, other than setting an instance of the form to "Nothing" then
redeclaring it?

Quick and dirty: Clear the form's 'Controls' collection and re-populate it
by calling the form's 'Sub InitializeComponent'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top