DialogResult from a MessageBox.Show
Posted on 2006-11-25
How do i use the DialogResult (or something similar) from a MessageBox.Show that has a yes/no option on it? I want to do one thing if the user selects the yes and another thing if no... i'm sure you get the picture.
i tried the following in my "Private Sub CheckOutMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckOutMenuItem.Click"
MessageBox.Show(messagestring, "Check Out", MessageBoxButtons.YesNo, MessageBoxIcon.Hand)
If optionSelected = DialogResult.Yes Then
totalSales.salesNumberInteger(1) += TotalCost
'totalSales.salesNumberInteger(0) = 0
ElseIf optionSelected = DialogResult.No Then
but when i test it and select either yes or no, i don't get any results... it seems like VB.NET transfer control/focus to something else and my "IF" statement isn't executed. is there another object that should be used with MessageBox.Show?