Msgbox("howto",MsgBoxStyle.OKCancel, "test")

Raddict

Active member
Joined
May 19, 2005
Messages
28
Location
Rotterdam (Holland)
Programming Experience
3-5
Hi,

I normaly use msgboxes only for informing the user. Now I want to use the cancelbutton to let my program run another subroutine than the ok button.

Can anyone help me with this?

I tried:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("ok=greenen cancel=red", MsgBoxStyle.OKCancel, "test")

If MsgBoxResult.OK Then
Button1.BackColor = Color.Green
Else
Button1.BackColor = Color.Red
End If

End Sub

But it always causes the button to turn green :confused:
 
Dim Result As DialogResult
'Displays the MessageBox
Result = MessageBox.Show(Me, Message, Caption, Buttons)
' Gets the result of the MessageBox display.
If Result = DialogResult.Yes Then
Button1.BackColor = Color.Green
Else
Button1.BackColor = Color.Red
End If


Try that
 
Back
Top