Multi-select in Combobox,listbox

Posted by: geert on 8 September 2017, 5:30 am EST

  • Posted 8 September 2017, 5:30 am EST

    Hello,

    I have version 4 of winspread. In my next version of my software the user must be able to select more then one option in a listbox, combobox.

    Is this possible in the current version 5.0 of the spread, or do I still have to override the listbox class?

    If so, do you guys have an exemple of implementing it?

    If the user selects more then one option I want to list all the selected items seperated with a comma.

    Thanks!

  • Posted 8 September 2017, 5:30 am EST

    There is no built in functionality for multiple selection in the ComboBox CellType, you are correct you will need to create your own listbox.

  • Posted 8 September 2017, 5:30 am EST

    Hi,

    ListBoxCellType.SelectionMode was added in v5 to enable multiple selections.  With v5, you would not need to subclass it.

    The complete list of enhancements in each version is listed here: http://www.fpoint.com/netproducts/spreadwin/whatsnew.aspx

  • Posted 8 September 2017, 5:30 am EST

    Thanks, I tried it and it works perfect. I see that it's not possible to define the dropdownstyle like listbox, dropdownlist.

    The thing is that the height of the row must be changed that every item can be displayed. What if I have 20 possible choices??

  • Posted 8 September 2017, 5:30 am EST

    Hello,

    After setting the ListBoxCellType, you can try setting the Height of that particular row using GetPreferredRowHeight method. Here is the code to achieve the same:-

    fpSpread1_Sheet1.Rows[0].Height = fpSpread1_Sheet1.GetPreferredRowHeight(0, false);

    Hope this will help you. Thanks.

  • Posted 8 September 2017, 5:30 am EST

    Hi,

    You could use ComboBoxCellType to make a custom cell type that uses a multiselect list box subeditor instead of the default one, and override GetEditorValue and SetEditorValue to get and set the selected indexes like ListBoxCellType when SelectionMode is set to multiselect.  Another option, if you want to use a popup Spread control as the subeditor for a multicolumn popup list, would be to make a custom cell type inheriting from MultiColumnComboBoxCellType and code in the SubEditorShowing event to configure the popup Spread to use OperationMode.MultiSelect (you would also need to override GetEditorValue and SetEditorValue, since MultiColumnComboBoxCellType does not support SelectionMode).  There is an example in the SpreadWinDemo sample celltypes form showing how to use SubEditorShowing to configure the popup Spread for MultiColumnComboBoxCellType.

  • Posted 8 September 2017, 5:30 am EST

    I prefer the way of the comboboxcelltype and the multiselected listbox. Is there a manual of overriding a method of a cell type?

    Thanks!

  • Posted 8 September 2017, 5:30 am EST

    Hello,

    You may have a look at the FarOut sample installed in your machine, it demonstrate the method to create a custom celltype.You may find that at the following location:

    C:\Program Files\FarPoint Technologies\Spread.WinForms.4.dotNet20\v4.0.2026\Samples\Vb\FarOut!

     

    Thanks,

     

     

  • Posted 5 April 2018, 6:06 pm EST

    Hello,

    Is there an option to have Multi Select dropdown for Web Forms.

    Thanks,

    Anish Raju

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels