Accessing additional combobox columns...


Author
Message
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What you need to do, Mike, is only set the DisplayMember on the combo box.  When you only set the display member, and leave the ValueMember blank, the combobox's SelectedValue property will return an instance of the business object that was use to populate the combo box.  So, say this is the scenario:

1) you have MyBO dropped on the form
2) you have MyBBS (BusinessBindingSource) dropped on the form
3) you have MyBBS.BusinessObject set to MyBO
4) you have ComboBox1 dropped on the form and the DataSource property set to MyBBS
5) you have ComboBox1.DisplayMember set to "EmployeeName" and the ValueMember property left blank

When you run, the combo box will fill with the EmployeeName for every record in the business object.  When you access the ComboBox1.SelectedValue property, you will receive an instance of the MyBO class (an actual business object), on which, you can access all of the other columns within the business object (no just EmployeeID).

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search