I have a datasource created. I need to get it attached to my comboboxtool on my toolbar.
Here is my code:
Dim dsrc_Terr As New UltraDataSource (this is built in another part of code.)
Dim toolbar_RB As UltraToolbar = CType(utm_CommissionsReview.Toolbars("utb_ReviewBy"), UltraToolbar) Dim terr_CB As ComboBoxTool = CType(toolbar_RB.Tools("cmb_Territories"), ComboBoxTool)
Dim terr_list As BindableValueList = New BindableValueList()
terr_list.BindingContext = Me.BindingContext terr_list.SetDataBinding(dsrc_Terr, String.Empty) terr_list.DisplayMember = "_TRDM" terr_list.ValueMember = "_TRCODE" terr_CB.ValueList = terr_list
No errors. No data in the combo.
Can anyone tell me what I am doing wrong?
-Duane
I think the problem is that you are not specifying a DataMember when you call SetDataBinding.What's happening here is that since you are binding to the UltraDataSource with no DataMember, the UDS ends up returning a list of tables, rather than a list of rows within a table. So you end up with one blank row on the Combo.
Try this:
terr_list.SetDataBinding(dsrc_Terr, dsrc_Terr.Band.Key)
Mike,
Your code did display one column in the dropdown (the .displaymember column). Can the comboboxtool display all of the columns that are in the datasource?
No, the ComboBox tool is a simple combo that only displays a single column. If you want a mutli-column dropdown in your toolbar, what you could do is use a ControlContainerTool and put an UltraCombo into it.