msgbox 上的引用按钮
Referencing buttons on msgbox
我正在将消息框编码到我的游戏中以确认流程已完成。我的消息框已显示,并且正在运行。当我单击“确定”时,如何让它运行我的代码的新部分? (我不知道如何将代码连接到消息框内的按钮)1
你可以这样做:
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
If ProgressBar1.Value = 1000 Then
Timer1.Enabled = False
Dim msgResult As MsgBoxResult = MsgBox("Program has been loaded", MsgBoxStyle.OkOnly, "Click to continue")
If msgResult = MsgBoxResult.Ok Then
DoSomething()
End If
End If
End Sub
Private Sub DoSomething()
MsgBox("You did something")
End Sub
或者,您可以在 MsgBox 之后调用其中一个子程序而不获取结果,因为无论如何都只会返回一个结果。
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
If ProgressBar1.Value = 1000 Then
Timer1.Enabled = False
MsgBox("Program has been loaded", MsgBoxStyle.OkOnly, "Click to continue")
DoSomething()
End If
End Sub
Private Sub DoSomething()
MsgBox("You did something")
End Sub
我正在将消息框编码到我的游戏中以确认流程已完成。我的消息框已显示,并且正在运行。当我单击“确定”时,如何让它运行我的代码的新部分? (我不知道如何将代码连接到消息框内的按钮)1
你可以这样做:
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
If ProgressBar1.Value = 1000 Then
Timer1.Enabled = False
Dim msgResult As MsgBoxResult = MsgBox("Program has been loaded", MsgBoxStyle.OkOnly, "Click to continue")
If msgResult = MsgBoxResult.Ok Then
DoSomething()
End If
End If
End Sub
Private Sub DoSomething()
MsgBox("You did something")
End Sub
或者,您可以在 MsgBox 之后调用其中一个子程序而不获取结果,因为无论如何都只会返回一个结果。
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
If ProgressBar1.Value = 1000 Then
Timer1.Enabled = False
MsgBox("Program has been loaded", MsgBoxStyle.OkOnly, "Click to continue")
DoSomething()
End If
End Sub
Private Sub DoSomething()
MsgBox("You did something")
End Sub