2016-12-02 72 views
-4

的菜單欄上的退出應用程序標籤時,那麼應該顯示消息框是的,如果我點擊是然後應用程序關閉,如果我點擊沒有應用程序應該不會關閉和形式還活着,這是開放當我們點擊MDIParent1的菜單欄上的退出應用程序標籤時,當我們點擊MDIParent1

Private Sub ExitApplicaionToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitApplicaionToolStripMenuItem.Click 

    MessageBox.Show("Are you sure you want to exit?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) 

    If MsgBoxResult.Yes Then 

     Application.Exit() 

    Else 

     'Focus remain on targeted form which is open that time 

    End If 

End Sub 
+3

謝謝你告訴我們這一點。但是,您的問題缺少一個問題。 – Takarii

回答

3

展示法returns the dialogresult:

If MessageBox.Show("Are you sure you want to exit?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = MsgBoxResult.Yes Then 
    Application.Exit() 
End If 
相關問題