在VB.NET中关闭对话框? [英] Closing Dialog in VB.NET?
本文介绍了在VB.NET中关闭对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果按下关闭按钮,如何在窗体中添加类似msgbox的内容?我的意思是,如果按下关闭按钮,则会出现一个具有不同选择的对话框.
How can I add something like msgbox in a form if close button is pressed? I mean that if the close button is pressed then a dialog appears with different choices.
推荐答案
尝试以下代码:
Try below code:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If (MessageBox.Show("Close?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No) Then
e.Cancel = True
End If
End Sub
有关更多信息,请参见以下链接:
http://stackoverflow.com/questions/2256869/vb-net-abort-formclosing [ ^ ]
See following link for more information:
http://stackoverflow.com/questions/2256869/vb-net-abort-formclosing[^]
这篇关于在VB.NET中关闭对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文