filtered comboboxes in datagridview

divjoy

Well-known member
Joined
Aug 25, 2013
Messages
159
Programming Experience
1-3
Hi,

I have 2 comboboxes in a datagridview and depepending on what value I choose in the first combobx I want the second combobox to be filtered to a subset of its orginal list of values.

This would ean that each rows combobox woudl show a different list of values.

From looking on the net the best ways is to use filtering on combobox 2 but its the events iam not sure about.


What is the best event to use on the first combobox and how do I change a specific rows combobox2 list without changing all the comboboxes?

kind regards
 
Hi,
I have had some success, here is a small example below

VB.NET:
Private Sub DataGridView3_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView3.CellEndEdit
        'When any cell in dgv is edited.
        Dim SerProvider As String
'Combobox1 is on the fourth column of the datagridview        
If e.ColumnIndex = 4 Then
                'Change List of combobx Status depending on Value in combobox1
                SerProvider = Me.DataGridView3.CurrentRow.Cells(4).Value.ToString
                Select Case CInt(SerProvider)
                        Case 14    'combobox1 shows "Waiting"
                              ds.Tables("ServiceStatus").DefaultView.RowFilter = "ID IN (1,2,3)"
               End Select
            End If



    End Sub

But the problem is ALL the comboboxes in the datagridview are filtered, I only want the current rows combobox2 to be filtered!

Any ideas appreciated!
 
Back
Top