.NET
i need usage of if condition for more than 4 condition true and also false
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Syed ShanuRank #87 · 23.7K reputationPosted Mar 23, 2015, 11:21 PM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 24, 2015, 1:16 AM EDT
Hi,
May be you can use switch case over here
switch (str)
{
case "akkjdg":
//Do...
break;
case "hjdgfh":
//Do...
break;
case "jghfgjkf":
//Do...
break;
default:
Console.WriteLine("enter the value or should not null.");
break;
}
hope this will help you.
Joginder BangerRank #360 · 7K reputationPosted Mar 23, 2015, 10:16 PM EDT
if(condition1=false&&condition2==true)
{
}
try make a condition ....
Syed ShanuRank #87 · 23.7K reputationPosted Mar 23, 2015, 10:19 PM EDT
Boolean cond1=true,cond2=true,cond3=true,cond4=false;
if (cond1 == true && cond2 == true && cond3 == true && cond4 == false)
{
MessageBox.Show("true");
}
else
{
MessageBox.Show("false");
}
//using IF and elseif
if (cond1 == true)
{
MessageBox.Show("Con1 true");
}
if (cond2 == true )
{
MessageBox.Show("Con2 true");
}
if (cond3 == true )
{
MessageBox.Show("Con3 true");
}
else
{
MessageBox.Show("Con4 false");
}
Durga VelusamyRank #4,868 · 321 reputationPosted Mar 23, 2015, 11:16 PM EDT
if(codtn=="akkjdg"&&cond=="hjdgfh"&&cond=="jghfgjkf")
{
if 1st cond means
form frm=new frm();
frm.show();
if 2nd condn means
form frm=new frm();
frm.show();
}
else
{
MassageBox.Show("enter the value or should not null")
}