I'm learning WinForm, and in a recent practice, I wanted to realize such a function:
A ComboBox with some other controls in form. And ComboBox's DisplayMember is the "Name" of each control, and the ValueMember is their "Handle".
Like this.

However, it didn't work so well, and when I debug, I found the after binding the DataSource, the DisplayMember shows a empty string.

Also the ValueMember setting shows error if I set it "Handle".
Are there any rules when using these two properties?
Code are as follow.
cmbAllControls.DataSource = allControlsList;//DataSource, List<Control>.
cmbAllControls.DisplayMember = "Name";
cmbAllControls.ValueMember = "TabIndex";//TabIndex is OK, but Handle will throw error.
GetWindowText(). Try to use the "Text" property as theDisplayMember. You might be surprised. You could (should) use a simple custom class, with some Properties (i.e., Name (string), Handle (IntPtr) and Control (Control). Use aList<class>as theComboBox.DataSource. You can then access all the properties of any Control castingSelectedItemto your custom class Type. - JimiTextproperty becase that property is browsable. Also, possibly, set theDisplayMemberandValueMemberbefore you set theDataSource. - Jimi