且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何声明其他if语句

更新时间:2022-12-23 12:14:35

请看我对这个问题的评论,并按字面意思完成你最后一句中所写的内容。



-SA


如果显示消息框时只有 不需要第二个if()语句然后按照罗伯特的建议 - 例如:

  bool  doSecond =  true ; 
if ()
{
// 执行某些操作,如果应该触发第二个
}
else if ()
{
messagebox.show( hai跨度>);
doSecond = false ;
}
其他
{
// 做一些事情,第二个如果应该开火

}


如果(doSecond&& ifCondition)
{
// 不要这样做仅当显示消息框
}
否则
{
}


i am having two statement in single click event

if()
{
}
else if()
{
messagebox.show("hai");
}
else
{
}


if()
{
}
else
{
}



if that messagebox in first statement executed, second statement should not execute otherwise both need to execute.. how to do that..., help me out :,

Please see my comment to the question, and do exactly what is written in your last clause literally.

—SA


If it''s only when the message box is shown that the 2nd if() statement is not required then go with Robert''s suggestion - for example:
bool doSecond = true;
if()
{
    //do something and 2nd if should fire
}
else if()
{
    messagebox.show("hai");
    doSecond = false;
}
else
{
    //do something and 2nd if should fire
}


if(doSecond && ifCondition )
{
    //don't do this only when message box shown
}
else
{
}