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
215
Unable to display selected Index on form Load for UltraToolbar Manager ComboBoxTool
posted

I want to force the toolbarstyle but I can't get the "Office2013" to display when formloads.  

Using SelectedIndex gets an error (

System.ArgumentOutOfRangeException occurred
HResult=0x80131502
Message=Index was out of range. Must be non-negative and less than the size of the collection.)

Code used:

Infragistics.Win.UltraWinToolbars.ComboBoxTool cb = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("ComboBoxTool1");
ultraToolbarsManager1.Style = ToolbarStyle.Office2013;
cb.SelectedIndex =0;

Parents
No Data
Reply
  • 6158
    Suggested Answer
    Offline posted

    Hello Felix,

    Looking at your code, it appears that you are creating a new ComboBoxTool and attempting to set the SelectedIndex without adding any items to it's ValueList. As such, 0 is an invalid index. Here is a help article that demonstrates how to programmatically create a ComboBoxTool, add ValueListItems to it, and then add the control to the UltraToolbarsManager.

    Let me know if you have any questions.

    Chris

Children