Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

The below is my code.

private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (radioButton2.Checked == true)
            {
                comp.CLASSID = Convert.ToInt32(comboBox2.SelectedValue.ToString());
                comp.ACADAMICYEAR = textBox1.Text;
                comp.MEDIUM = comboBox1.Text;
                comp.SECTIONNAME = Convert.ToChar(comboBox4.Text);
                DataTable studentdet = inter.getstudentlistforclass(comp);
                dataGridView1.DataSource = studentdet;
                DataGridViewTextBoxColumn fourthcolumn = new DataGridViewTextBoxColumn();
                fourthcolumn.HeaderText = comboBox7.Text;
                fourthcolumn.Name = comboBox7.Text;
                dataGridView1.Columns.Add(fourthcolumn);
                
                
            }
        }


private void comboBox6_Leave(object sender, EventArgs e)
       {


           if (radioButton2.Checked == true)
           {
               comp.CLASSID = Convert.ToInt32(comboBox2.SelectedValue.ToString());
               comp.ACADAMICYEAR = textBox1.Text;
               comp.MEDIUM = comboBox1.Text;
               comp.EXAMNAMES = comboBox6.Text;
               DataTable subjectname = inter.getexamnamefordatagridastable(comp);
               comboBox7.DataSource = subjectname;
               comboBox7.DisplayMember = "SubjectName";
               comboBox7.ValueMember = "SubjectCode";
           }
       }

when i working with combobox7_selectedevent, after completing this event it automatically going to combobox6_leave even at the place of
C#
comboBox7.DataSource = subjectname;
                comboBox7.DisplayMember = "SubjectName";
                comboBox7.ValueMember = "SubjectCode";


I dont want to go through this way. i want to stop that focus only in combobox7 event. Is any idea?
Advance Thanks
Posted

1 solution

You are wrong your assumption it actually doing the other way.

combobox6_leave occurs first and the execution control transfer to combobox_7 selection changed event.
if you have alread querying inside combo_7 selection change event you can skip setting it from combo6 leave method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900