Advertisement
Haulien

dialogresult

Apr 2nd, 2011
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.84 KB | None | 0 0
  1. '' to catch the dialog's result output
  2. Dim MessageBoxResult As DialogResult
  3.  
  4. '' telling what ^ should be getting its result from
  5. '' + your messagebox
  6. MessageBoxResult = MessageBox.Show("Hello World", "Button Test", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
  7.  
  8. If MessageBoxResult = DialogResult.Yes Then
  9.     '' if you click "Yes" then do this
  10.     MessageBox.Show("You pressed the Yes button!", "Yes!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  11.  
  12. ElseIf MessageBoxResult = DialogResult.Cancel Then
  13.     '' Alt way of checking
  14.     '' if cancel is checked, then do this
  15.     MessageBox.Show("You pressed the Cancel button!", "Cancel!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  16.  
  17. Else
  18.     '' if you click "No" then do this
  19.     MessageBox.Show("You pressed the No button!", "No!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  20.  
  21. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement