Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1310
Attach a DataSource to a Combobox on a ToolBar
posted

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

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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)

Children