"Resetting" a form

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

Guest

I have a CSV processing program that instantiates Excel and performs various
operations. I want the ability to reset the main form for running another
data set with defaults selected. Right now I am one-by-one restoring every
control to its initial state, but it occurred to me that if I could unload
and reload the main form (from another module) that I could quickly and
cleanly accomplish the same thing... right? But how would I do this in .Net?

Randall Arnold
 
Randall said:
I have a CSV processing program that instantiates Excel and performs various
operations. I want the ability to reset the main form for running another
data set with defaults selected. Right now I am one-by-one restoring every
control to its initial state, but it occurred to me that if I could unload
and reload the main form (from another module) that I could quickly and
cleanly accomplish the same thing... right? But how would I do this in .Net?

Randall Arnold


Create a module with a sub mail in it. In the module so something like...
sub main()
dim F as new form
application.run(F)
end sub

Then make the module your startup object and you are good to go.

Chris
 
That's actually very similar to what I wound up doing, which is:

Private Sub ResetAll_button_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles ResetAll_button.Click
Call Module1.Reset()
Me.Close()
End Sub

Module Module1
Public Sub Reset()
Dim Form1 As New Form1
Form1.Show()
End Sub
End Module

Works like a charm! But thanks for responding (I may try yours to see if
it's better).

Randall
 

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