如何停止专注于控制 [英] how to stop focus on control
本文介绍了如何停止专注于控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,
以下是我的代码。
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 (对象发送者,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;
}
}
当我使用combobox7_selectedevent时,完成此事件后它会自动转到combobox6_leave,即使在
comboBox7.DataSource = subjectname;
comboBox7.DisplayMember = SubjectName;
comboBox7.ValueMember = SubjectCode;
我不想通过这种方式。我想仅在combobox7事件中停止焦点。有什么想法吗?
提前谢谢
解决方案
你错误地认为它实际上是在做另一种方式。
首先发生combobox6_leave并且执行控制转移到combobox_7选择更改事件。
如果你在combo_7选择更改事件中有查询,你可以跳过从combo6 leave方法设置它
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
解决方案
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.
这篇关于如何停止专注于控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文