display a clean new form - form.ShowDialog()

  • Thread starter Thread starter Patino
  • Start date Start date
P

Patino

I'm woking with CF 2.0.
I create a form then display it with ShowDialog. After the user
finished entering the data in this form, he clicks on Submit, and the
form disappears. Later on I want to reuse this same form, but I want to
display it blank again (e.g. have all its textboxes blank on a complete
new form). Unfortunately, I displayed the last previous form used, not
a blank one. How can I accomplish this?

Thanks in advance!
 
You could call Dispose on the form instance after the call to ShowDialog
completes and then recreate the form instance when necessary. However, it
sounds like this may be a form that is frequently used. Instead, you may
want to expose a public method on the form that, when called, will clear the
appropriate controls. This method may even be beneficial to the user if at
some point in time in the future is was exposed through the user interface
to allow them to clear the form and start fresh.
 
Back
Top