Click here to Skip to main content
11,641,659 members (58,068 online)
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)

  Print Answers RSS
0 Mika Wendelius 290
1 DamithSL 223
2 Afzaal Ahmad Zeeshan 139
3 OriginalGriff 110
4 Suvendu Shekhar Giri 65
0 Mika Wendelius 460
1 OriginalGriff 215
2 DamithSL 213
3 CPallini 169
4 Afzaal Ahmad Zeeshan 129


Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2015
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