如何在messagebox中显示的内容中添加条件 [英] How to add condition on what is shown in messagebox

查看:221
本文介绍了如何在messagebox中显示的内容中添加条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序.....现在在其中我想开发一个条件显示什么消息框........但我不知道如何做到这一点,你知道这样的事情.. ....

  if (messagebox.text ==  玩家1获胜){
a ++
}





plz help ...........怎么做.........

解决方案

< blockquote> AoA,

尝试这样的事情

  void  MyMessage(< span class =code-keyword> string  txt)
{
if (txt == 玩家1获胜
{
// 显示消息
}
else if (txt == 玩家1输掉
{
// show message
}
// 依此类推
}


您可以使用开关案例来实现此目的。检查链接:



El clicko [ ^ ]


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......

if (messagebox.text=="player 1 wins"){
a++
}



plz help...........how to do this.........

解决方案

AoA,
try something like this

void MyMessage(string txt)
{
  if( txt == "player 1 wins" )
  {
   //show message
  }
 else if( txt == "player 1 lose" )
 {
  //show message
 }
 // and so on
}


You can use a switch case to achieve this. Check the link:

El clicko[^]


这篇关于如何在messagebox中显示的内容中添加条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆