0

如果我想将 MessageBoxButtons.Ok 或 MessageBoxButtons.OkCancel 发送到 MessageBox 并且我想将正确的值存储在变量中,我应该将它调暗到什么类型?

Dim MyVariable As ______ 
If <condition> Then
   MyVariable = MessageBoxButtons.Ok
Else
   MyVariable = MessageBoxButtons.OkCancel
End If

MessageBox.Show("Message", "Title", MyVariable)
4

1 回答 1

1
If MessageBox.Show("some text", "caption", MessageBoxButtons.OKCancel) = Windows.Forms.DialogResult.OK Then
  'they picked ok
End If

或者:

Dim result As DialogResult
result = MessageBox.Show("some text", "caption", MessageBoxButtons.OKCancel)
于 2014-04-03T23:25:20.520 回答