combobox-question


Author
Message
Thomas Holste
Thomas Holste
Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

is it possible to fill the dropdown-list of a multi-column combobox manually? And how has this to be done?

Thanks in Advance

Thomas
Replies
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
Howdy Thomas,

Yes, you can use the MultiColumns and populate manually, but you still have to use the .NET-style data source for the combo box.  Basically, you have to have a list behind the combo box that defines the items, and the easiest way to do this is with a DataTable, but you can just as easily create a custom class with a few properties and use a generic list with a BindingSource, but the DataTable already has all of those interfaces on it.

  1. Create a DataTable with 3 columns, "Display" (string), "Value" (object), and "DropDown" (string).  
  2. Populate it with rows for the items you want in the combo box
    1. The value in the Display column will show as the selected item when the combo box is closed
    2. The value in the Value column will be the SelectedValue on the combo box for binding
    3. The value in the DropDown column will be what is used to render the drop down.  Combine all of the columns into this field and pipe delimit them:  "Column 1|Column 2|Column 3"  The pipes are used to split the columns when rendering the drop down.
  3. Set the UseMultiColumns to true
  4. Set DropDownMember to "DropDown"
  5. Set DisplayMember to "Display" 
  6. Set ValueMember to "Value"
  7. Set the DataSource property to your data table.
That should do it.  Anything you put into the DataTable gets added as a row in the combobox.
Thomas Holste
Thomas Holste
Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ben,

thanks for the explanation, I will try it immediately.

Best regards

Thomas
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