Refresh forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a question concerning closing and re-opening forms. When I open a
form and make changes or enter some data, then close the form and re-open it,
the same data/changes are still there. How can I re-open the form as though
it is the first time I have opened it? In other words, I want to re-open the
form as though it is a new instance of the form with all fields and variables
empty.

Can someone tell me how to do this?

TIA

Mike S
 
Sounds like you are using the default instance of the form. So either create
your own instance each time you need the form or add a public DoRefresh
method to your form (which would reset the form to its initial values) and
call it right before you use (show) the form each time.
 
MikeS said:
I have a question concerning closing and re-opening forms. When I open a
form and make changes or enter some data, then close the form and re-open it,
the same data/changes are still there. How can I re-open the form as though
it is the first time I have opened it? In other words, I want to re-open the
form as though it is a new instance of the form with all fields and variables
empty.

Can someone tell me how to do this?

TIA

Mike S

Check to see where you form is being dim'd
it might look something like this:
DIM fbla AS Form

you most likley are missing the "NEW" parameter.

DIM fbla AS NEW Form
 
If the values are global setting, you wanna save those for next running,
please bind the value to ApplicationSettings. All settings will be saved to
and reloaded from your app.config automatically.

If you just want to save those in one instance, there are 2 ways to deal
with it.
1 Create a module or static class and define all value you need with saving
all of that while closing that form. When re-open it, just reload that from
those value by your code.
2 Create a module or static class to hold the define of that form (Dim xxx
As Form1). Use xxx.Hide to hide your form instead of closing it. And Use
xxx.Show to reopen it.
 
Back
Top