[RESOLVED] Combobox collection
I have a combobox that I want to set the properties for in the code instead of the properties window. I could have sworn that I had previously answered this in this forum, but was unable to find the thread. I am using the databindings.add method to show what currently resides in the column.
The collection for the combobox comes from another table. So I thought what I had below would get the job done. It didn't. I do get the current value, but the list of names from the other table does not show.
So where did I go wrong....... again.
Code:
.cmbManager.DataSource = frmEvent.tblEmployeeBindingSource
.cmbManager.DisplayMember = "strFullName"
.cmbManager.ValueMember = "strFullName"
.cmbManager.DataBindings.Add(New Binding("Text", frmEvent._MasterBase5_0DataSet, "tblEventMaster.strManager"))
I know I can, and probably will, set the datasource, displaymember and valuemember in the properties window, but I would still like to understand why this won't work and what I did wrong.
Re: [RESOLVED] Combobox collection
A small note: set the DataSource last. The list is populated when you set the DataSource and setting the DisplayMember afterwards meaning changing the list. Setting the DataSource last means no change to the list is required.
Re: [RESOLVED] Combobox collection