I have a two column list in my combobox and when I choose one of the items in it using the drop down list, it stores (what I see in the textbox part of the combobox) only the va
What you describe is theoretically possible, but with restrictions.
Even when you didn't ask for that, here comes my idea:
Like described here you can change your ComboBox's text
without changing its value
. This allows you to 'store' the underlying value while displaying both columns in one.
Listen on the SelectedIndexChanged Event and change the text
property as follows:
Sub ComboBox1_SelectedIndexChanged()
ComboBox1.Text = ComboBox1.Column(0) & "-" & ComboBox1.Column(1)
End Sub
(This is only a basic example.) Can't test it right now, but in .Net you can use CType
to explicitly convert the sender
argument to a ComboBox variable and access it this way.
The Boundcolumn
property can't be changed to multiple values. You can try to use VbTab
as a delimiter in the text field but i'm not sure how it will appear.
Edit:
Don't forget the default values. I think your Text field should show both columns before the user clicked on the list the first time, too.