MsgBox什么要点击两次确认?
- VB.NET code
MsgBox("除", MsgBoxStyle.YesNo)//要点击两次确认 Dim resultCode As Integer = 0 resultCode = MsgBox("asd", MsgBoxStyle.YesNo).GetHashCode If resultCode = MsgBoxResult.Yes Thenend if
[解决办法]
If MsgBox("asd", MsgBoxStyle.YesNo).GetHashCode == DialogResult.Yes Then
试试,我不是很懂vb,你查一下msdn,只用一行代码或者用DialogResult枚举,就会只点一次。原理大概是因为MsgBoxResult.Yes 又实例化了一次,好像,记不得了
[解决办法]
- C# code
private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("hegheheh","warning",MessageBoxButtons.YesNo)== DialogResult.Yes) { this.label1.Text = "sucess"; } }
[解决办法]