[英]How to refresh ComboBox data (Form-1), after updating Data Grid View Data(Form-2)
ComboBox is data-bound to "Quality Setup Table" ComboBox与“质量设置表”数据绑定
ComboBox: Display Members "Quality Code: 401, 402, 403 etc." ComboBox:显示成员“质量代码:401,402,403等”
When I open Form 2 - (DataGridView), perform changes and Close. 当我打开表单2 - (DataGridView)时,执行更改并关闭。 new updated data doesn't reflect in ComboBox. 新的更新数据未在ComboBox中反映出来。
I have to close application and restart to see the newly added data in ComboBox. 我必须关闭应用程序并重新启动以查看ComboBox中新添加的数据。
What should I do to update ComboBox Data with Newly Added/Removed Data in Data Grid View after Closing Form 2. 关闭表单2后,如何更新数据网格视图中新添加/删除数据的ComboBox数据。
Did you try ComboBox.DataBind() when you are updating DataGridView ? 在更新DataGridView时是否尝试过ComboBox.DataBind() ?
I think you can Find the control from the form and invoke the DataBind() method to refresh the Items of the ComboBox. 我认为你可以从表单中找到控件并调用DataBind()方法来刷新ComboBox的Items。 Hope this helps 希望这可以帮助
I have found solution to my own problem. 我找到了解决自己问题的方法。
In order to update ComboBox with New Data. 为了使用新数据更新ComboBox。
Write this in form 1. 写下表格1。
Form2 form2 = new Form2(); Form2 form2 = new Form2();
form2.showDialog(); form2.showDialog(); // it must be show dialog only not show. //它必须是show对话框才显示。
// below here write code that fills data into comboBox // you can find this code in Form1_Load. //在这下面写下将数据填入comboBox的代码//你可以在Form1_Load中找到这段代码。 // once that is done. //一旦完成 Your comboBox will begin updating data whenever Form2 Closes. 只要Form2关闭,您的comboBox就会开始更新数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.