开发者

VB restart form

开发者 https://www.devze.com 2022-12-25 08:06 出处:网络
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

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_开发者_JAVA百科Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

End Sub


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.


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

Me.Close()
Me.Show()


Try This..

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号