How can I handle ComboBox selected index changing?

前端 未结 10 1247
花落未央
花落未央 2020-12-21 06:10

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 mo

10条回答
  •  猫巷女王i
    2020-12-21 06:52

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

    this.ComboBox1.SelectedIndexChanged += new system.EventHandler(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.

提交回复
热议问题