使用下面的代碼,調用第二個函數(Checkbox1.CheckedChanged)的最佳方法是什麼?我嘗試使用(發件人,電子郵件),但隨後它不斷調用App2.msi每次程序完成安裝,拋出程序進入一個連續的循環,因爲它試圖重複安裝App2.msi ..試圖沒有發件人「調用CheckBox1_CheckedChanged ()「,但然後我的代碼不會編譯。VB.Net調用此函數的最佳方式是什麼?
我很新的VB,所以我不知道如果我應該以不同的方式調用msi或如果我只是不夠知識,但瞭解如何調用這樣的東西。如果有人需要更多的細節,請讓我知道!謝謝!
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim p1 As New Process
p1 = System.Diagnostics.Process.Start("App1.msi")
p1.WaitForExit()
CheckBox2.Checked = True
Label2.Visible = True
Call CheckBox1_CheckedChanged()
End Sub
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
End Sub
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
Dim p1 As New Process
p1 = System.Diagnostics.Process.Start("App2.msi")
p1.WaitForExit()
CheckBox1.Checked = True
Label3.Visible = True
End Sub
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
End Sub
End Class
嘗試取出CheckBox1.Checked = true在CheckBox1_CheckedChanged事件 – 2013-04-23 07:22:14
可我只是提到,控制命名是樣的重要和最佳實踐。這會爲你節省很多時間和困惑。 – Terry 2013-04-23 07:22:48
CheckBox1_CheckedChanged(Nothing,new EventArgs()) – 2013-04-23 07:24:28