alright i have a messagebox in a game im making... heres the code: Code (Text): MessageBox.Show("Play Again?", "You Win!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) what i want to know is how can i add code to the yes and no buttons inside the message box?
Store the button result in a variable, like this: Code (Text): Dim intAnswer as Integer intAnswer = MessageBox.Show("Play Again?", "You Win!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If intAnswer = 6 Then 'code to execute if the answer is "YES" Else 'code to execute if the answer is "NO" End If You're using VB.NET, right? Well, I dunno if it works with that version, but it works for VB6!!!