Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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
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 18-Dec-12 19:02pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100