We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ComboBox Multiple Selections

Thread ID:

Created:

Updated:

Platform:

Replies:

74750 Jun 26,2008 03:38 PM UTC Jun 30,2008 01:21 PM UTC WinForms 1
loading
Tags: GridControl
Edward Wilkerson
Asked On June 26, 2008 03:38 PM UTC

Hi

I have existing ComboBox's in a GridControl written in VB. I now want to enable multiple selections within the ComboBox using the CTRL key. I then need to store the selected rows of the ComboBox into a field in a table. Any help you might offer would be appreciated.


Sri Rajan [Syncfusion]
Replied On June 30, 2008 01:21 PM UTC

Hi Ed,

Thank you for your interest in Syncfusion products.

Combobox does not support multiple selection. But you can achieve this by hiding the default dropdown which is displayed when dropdown button in the ComboBox is clicked. Then showing the listbox for multiple selection, and display the selected items in the cell.
Please refer the below code for more details.

Private Sub l_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
l.Hide()
flag = 0
End Sub
Private Sub l_SelectedValueChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
If (Me.gridControl1(cc.RowIndex, cc.ColIndex).CellType = "ComboBox") Then
Dim str As String = ""
For i As Integer = 0 To l.SelectedItems.Count - 1
str += l.SelectedItems.Item(i).ToString()
Next i
Me.gridControl1(cc.RowIndex, cc.ColIndex).Text = str
End If
End Sub

Private flag As Integer = 0
Private Sub gridControl1_CellButtonClicked(ByVal sender As Object, ByVal e As GridCellButtonClickedEventArgs)
l.DataSource = list
l.Height = 70
Dim x As Integer=(e.Button.Bounds.X+e.Button.Bounds.Width)-l.Width
Dim y As Integer = (e.Button.Bounds.Y + e.Button.Bounds.Width)
l.Location = New Point(x,y)
If flag = 0 Then
l.Show()
flag = 1
End If
End Sub

Private Sub gridControl1_CurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridCurrentCellShowingDropDownEventArgs)
e.Cancel = True
End Sub

Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F74750/main.htm

Please let me know it this helps.

Best Regards,
Srirajan


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;