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:
 

levyuk

Well-known member
Joined
Jun 7, 2004
Messages
313
Location
Wales, UK
Programming Experience
3-5
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
 

Raddict

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

Now I see it, it starts to come back to me from a long time ago when I started with VB6 ;)
 
Top Bottom