hiba salem
hiba salem

Reputation: 67

VB restart form

I created a button and I need it to restart the form I have no idea how to work on the visual basic what should i write

Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

End Sub

Upvotes: 2

Views: 20058

Answers (3)

Muhammad Saeed
Muhammad Saeed

Reputation: 81

Try This..

Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Application.Restart()
End Sub

Upvotes: 0

Muhammad Saeed
Muhammad Saeed

Reputation: 81

In order to reload the form you simply need to do this in the form's Load event.

Me.Close()
Me.Show()

Upvotes: 0

CResults
CResults

Reputation: 5105

Do you mean Application.Restart() ?

Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

  Application.Restart()

End Sub

Although in Visual Basic this does the same as in C#, it restarts the application not just clears the form.

Upvotes: 6

Related Questions