.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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Syed ShanuPosted Mar 24, 2015, 3:21 AM
Jignesh TrivediPosted Mar 24, 2015, 5:16 AM
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.
Durga VelusamyPosted Mar 24, 2015, 3:16 AM
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")
}
Syed ShanuPosted Mar 24, 2015, 2:19 AM
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");
}
Joginder BangerPosted Mar 24, 2015, 2:16 AM
if(condition1=false&&condition2==true)
{
}
try make a condition ....