Restarting a program or Modal box without buttons in vbnet?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crusson
    New Member
    • Mar 2008
    • 18

    Restarting a program or Modal box without buttons in vbnet?

    I am making a program which opens textfiles, initiates a bunch of variables and opens the file for editing.

    I want to be able to close one text file and open another with the variables at their original settings.

    I think it would be easier just to completely exit the program and reopen it, so I created another form which only contains the new() sub

    Code:
        Public Sub New()
            MyBase.New()
    
            'This call is required by the Windows Form Designer.
            InitializeComponent()
    
            'Add any initialization after the InitializeComponent() call
            While Not bool
                Dim form1 As New Form1()
                bool = form1.ShowDialog()
            End While
        End Sub
    I want form1 to be a modal form where the accept or reject is passed by a click in the file menu rather than through a button. Any ideas?

    The other idea (easier) is to just restart the program with a me.restart() type command, but I don't know how to do that or what command i would use?
  • Sick0Fant
    New Member
    • Feb 2008
    • 121

    #2
    I can't believe that it would ever be considered good coding practice, but you can just "call" your form_load event.

    Comment

    • Sick0Fant
      New Member
      • Feb 2008
      • 121

      #3
      Also, there *is* a Me.Restart() method! Who'da thunk it.

      Comment

      Working...