我的Windows窗體應用程序有一個註銷按鈕,單擊時會提示MsgBox彈出詢問用戶是否確定他想記錄是否退出。我是新來的Visual Basic,所以我不知道我應該放在Elseif語句中,以便當用戶單擊MsgBox上的「否」時,MsgBox將消失,表單將再次顯示。這是我的代碼:當用戶單擊MsgBox上的「否」時程序不會返回到表單
Private Sub cmd_logout_Click(sender As Object, e As EventArgs) Handles cmd_logout.Click
MsgBox("Are you sure you want to log-out?", MsgBoxStyle.YesNo)
If MsgBoxResult.Yes Then
Me.Close()
ElseIf MsgBoxResult.No Then
(I'm not sure what I should put here I'm having a hard time figuring it out)
End If
End Sub
在此先感謝。