本文介绍了ComboBox_SelectedIndexChanged 中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在组合框中选择的索引更改时出错.如果我运行一个程序组合框选择的索引更改执行循环至少 3 次.

I have an error in combo box selected index changed. if I run a program combo box selected index changed executes cyclic for minimum 3 times.

DCNoComboBox.DataSource = Me.TableBindingSource
DCNoComboBox.DisplayMember = "ID"

这是代码.单击保存按钮时,组合框至少运行 3 次

this is the code. While clicking save button the combo box runs minimum 3 times

保存代码是

Me.validate
Me.tbl_Table1.bindingsource.EndEdit()
Me.tbl_table1tableadapter.UpdateAll(Me.Dataset1)

推荐答案

属性的赋值顺序必须是这样的.

Order of assigning property must be like this.

DCNoComboBox.DisplayMember = "DisplayItem"
DCNoComboBox.ValueMember = "ID"
DCNoComboBox.DataSource = Me.TableBindingSource

这篇关于ComboBox_SelectedIndexChanged 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 19:54