Hi,
I have two comboboxes.
combobox1 values
1000
1001
1002
1003
1004
combobox2 values
1000
1001
1002
1003
1004
Now I want to select data from database based on the two combobox value.
For example combobox1 = 1001 and
combobox2=1004, then I need to select data between these two values.
Actually I wrote code to get value from database.
The code for
combobox2_selectedindexchange
event is...
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(comboBox4.Text))
{
MessageBox.Show("From should not be empty");
}
else
{
comp.FROM = Convert.ToInt32(comboBox4.Text);
}
if (string.IsNullOrEmpty(comboBox5.Text))
{
MessageBox.Show("To Should not be empty");
}
else
{
comp.TO = Convert.ToInt32(comboBox5.Text);
}
DataTable result = inter.getapplicationinformationstage1(comp);
dataGridView1.DataSource = result;
}
But when I select data from
combobox1
, it automatically calls the event even I am not selecting the
combobox2
value and when I select any value from any one of combobox, then that value automatically set into another combobox.
How can solve this ?