如何在点击窗体右上角关闭按钮的时候发出一个信号?
我想在点击右上角关闭按钮的时候,发出一个信号:s = true,我应该把这行代码写在哪里呢?貌似每次窗体关闭的时候都会执行一下两个sub,关闭窗体的方法:我的程序里面有两个一个自己写的退出按钮和 窗体本身有的X按钮,求方法求解析求帮助,help!
Private Sub FrmLogin_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If s Then
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox1.Text = ""
Loado = ""
power = ""
unlogin = "未登录"
Else
End If
s = False
'===================这里有一个问题,即使无论前面怎样修改,在这里一定都要执行,一定要添加一个判断语句
End Sub
Private Sub FrmLogin_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
's = True
End Sub
[解决办法]
上面不是写了MessageBox了吗?
你把上面MessageBox代码分别替换成s=true和s=false