Selected Item Set, Ribbon Combobox

Jul 23, 2014 at 9:01 AM

I have 2 combo box's, both are populated in the following manner
        foreach (string s in ODBCList)
       RibDSNList.DropDownItems.Add(new System.Windows.Forms.RibbonButton(s));
This gives me 2 items for example 2005 2008.

When the program first loads the first item in the Combo box is blank and below that is the 2005 and 2008, once you have selected one of them the blank line disappears.

As part of my program it saves the last selected items and brings them up as the selected item.

No matter what i try i cant seem to set the selected value on the ribbon combobox.

I have tried
            RibDSNList.SelectedValue = ODBCCurrent;
            RibDSNList.SelectedItem.Text = ODBCCurrent;

I know ODBCCurrent has a string and is valid (As it works still on my form combo box's i was using

Any suggestions would be great!
Dec 5, 2014 at 3:57 PM
RibDSNList.TextBoxText = ODBCCurrent;
Dec 15, 2014 at 3:34 AM
you need to provide a value to the buttons as you add them. you are only adding the text so when the SelectedValue is set it looks through all the items for a matching Value. once you provide a value to the buttons it will all work.

RibDSNList.DropDownItems.Add(new System.Windows.Forms.RibbonButton { Text=s, Value=s });