1
我有5个不同的表绑定在Windows窗体上并使用C#。其中一个表是DataGridView。当我用下面的代码加载表单时,我想要关注的对象是自动的。如何将焦点设置到DataGridView之外的对象
this.termsTableAdapter.Fill(this.terms_DataSet.Terms);
this.customerTableAdapter.Fill(this.customer_Info_DataSet.Customer);
this.customer_ShipTableAdapter.Fill(this.customer_Info_DataSet.Customer_Ship);
this.customer_MailTableAdapter.Fill(this.customer_Info_DataSet.Customer_Mail);
当我行添加到DataGridView绑定,我不能将焦点设置在控制,我想设置,甚至与.Focus()如你看到下面
this.customer_Ship_ContactsTableAdapter.Fill(this.customer_Info_DataSet.Customer_Ship_Contacts);
customerComboBox.Focus();
为什么datagridview拥有焦点而不是我想要设置的控件?
我可以点击其他控件来改变焦点,但我希望它在form_Load中设置。
感谢汉斯用于快速响应。这是完美的答案 – 2014-11-06 20:50:40