如何处理组合框选择指数变化?组合、如何处理、指数

由网友(两点一线只为*忘记你)分享简介:我有一个组合框有制造商的列表。当用户选择的生产,下面的网格填充了对于所选择的制造商的数据。该数据可被修改。用户必须preSS保存按钮所有的改变都完成后。I have a ComboBox that have a list of manufacturers. When a user selects a manufact...

我有一个组合框有制造商的列表。当用户选择的生产,下面的网格填充了对于所选择的制造商的数据。该数据可被修改。用户必须preSS保存按钮所有的改变都完成后。

I have a ComboBox that have a list of manufacturers. When a user selects a manufacturer, a grid below is populated with data for the chosen manufacturer. That data can be modified. The user has to press the Save button after all changes are done.

但用户可以忘了preSS保存并选择从ComboBox其他制造商和电网将填充另一个数据,所以previous更改将丢失。

But the user can forget to press Save and select another manufacturer from the ComboBox and the grid will be populated with another data, so previous changes will be lost.

所以,我要问的用户,如果他想选择其他厂商之前保存更改。

So I need to ask user if he wants to save changes before selecting another manufacturer.

我怎样才能做到这一点?或者,也许你提供解决我的任务的另一种方式(从另一个角度看)?

How can I do this? Or maybe you offer another way of solving my task (looking from another angle)?

推荐答案

您应该处理ComboBox.SelectedIndexChanged事件。是这样的:

You should handle the ComboBox.SelectedIndexChanged event. Something like:

this.ComboBox1.SelectedIndexChanged += new system.EventHandler(ComboBox1_SelectedIndexChanged);

然后 ComboBox1_SelectedIndexChanged()只要稍有改变,你可以更新的功能,你的品牌信息会被调用。保存填充新的信息之前,旧的信息。或者提示用户,如果他们真的想在保存前改变它。

Then ComboBox1_SelectedIndexChanged() will be called whenever it changes and you can update your manufacturer info in that function. Save the old info before populating the new info. Or prompt the user if they really want to change it before saving.

阅读全文

相关推荐

最新文章