Click here to Skip to main content
15,907,395 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i got an app.....now in it I want to develop a condition on what message box is shown........but i dont know how to do this you know something like this......
C#
if (messagebox.text=="player 1 wins"){
a++
}


plz help...........how to do this.........
Posted
Comments
How did you initialize the MessageBox? I guess you can get the response, but not the Text.

AoA,
try something like this
C#
void MyMessage(string txt)
{
  if( txt == "player 1 wins" )
  {
   //show message
  }
 else if( txt == "player 1 lose" )
 {
  //show message
 }
 // and so on
}
 
Share this answer
 
v3
Comments
Ahsan98 10-Sep-13 11:25am    
no this is not working
just beat it i made an alternative method to do it
saad_lah 10-Sep-13 12:06pm    
you haven't explained the question well!
You can use a switch case to achieve this. Check the link:

El clicko[^]
 
Share this answer
 
Comments
Ahsan98 10-Sep-13 10:47am    
but how will switch help....switch will just make a condition.....i think what you mean to say is to make two conditions using switch player1 win and player2 win already thought about that but i have code mixed up and its too long to write again just tell me a method to check what the messagebox shows plzzzzz

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900