Hi
I have four comboBoxes,
If I have the following case,
(ComboBox1.selectedItem=="ID" && comboBox1.Text=="ID"&&ComboBox1.enabled=true)||
(ComboBox2.selectedItem=="ID" && comboBox2.Text=="ID"&&ComboBox2.enabled=true)||
(ComboBox3.selectedItem=="ID" && comboBox3.Text=="ID"&&ComboBox3.enabled=true)||
(ComboBox4.selectedItem=="ID" && comboBox4.Text=="ID"&&ComboBox4.enabled=true
then the application will continue. Otherwise a message box will be displayed saying that ID option must be selected first and the application will stop.
How to write this complex Condition? this condition needs to be checked when I click on "Start" button.
So, I expect that my application will not display the error message if at least one of the four comboBoxes has the selectedItem="ID" and the text="ID" and the combobox is enabled.
Loading

Hemant SrivastavaRank #581 · 4.2K reputationPosted Nov 5, 2013, 6:45 AM EST
Rano AH125 reputationPosted Nov 5, 2013, 7:27 AM EST
I have done that already after posting the question and it worked.
Thank you anyway
Afroz Khan3 reputationPosted Nov 6, 2013, 4:32 AM EST
private bool SetCondition(ref DropDownList combo)if(combo.SelectedIndex> 0)return combo.SelectedValue == "ID" && combo.Enabled;
{
else return false;
}Now the method like below
if (SetCondition(combo)) // Pass Combobox Id as reference
Do Operation