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
435
Filling a combobox tool valuelist in a Ribbon with a Datasource
posted

I have a Combobox tool on a tab in my Ribbon and I am wondering how I can fill it from a MS access datasource? 

Second question can this be a two collumns valuelist and can the keyvalue collumn be hidden.

this in VB.Net

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    You could do this using a BindableValueList. What you do is create the BindableValueList in code and then assign it to the ValueList property of the ComboBoxTool.


            Dim dt As DataTable = New DataTable
            dt.Columns.Add("Key", GetType(Integer))
            dt.Columns.Add("Text", GetType(String))
            Dim dr As DataRow = dt.Rows.Add()
            dr("Key") = 0
            dr("Text") = "Apple"

            dr = dt.Rows.Add()
            dr("Key") = 1
            dr("Text") = "Banana"

            dr = dt.Rows.Add()
            dr("Key") = 2
            dr("Text") = "Cherry"

            dt.AcceptChanges()


            Dim vl As BindableValueList = New BindableValueList()
            vl.DataSource = dt
            vl.ValueMember = "Key"
            vl.DisplayMember = "Text"
            vl.BindingContextControl = Me

            Dim myComboBoxTool As ComboBoxTool = DirectCast(Me.UltraToolbarsManager1.Tools("ComboBoxTool1"), ComboBoxTool)
            myComboBoxTool.ValueList = vl

Children