Hi,
Sorry about that, I converted the code to vb.
Since I am a newbie I need some help,
1) Where should I put the code you qouted above, in the Form Load event??
2) If So how will the DataGridView be able to access the FilteredTerritoriesBS
Here is the converted Code;
Private Sub Form1_Load(sender As Object, e As EventArgs)
Me.territoriesTableAdapter.Fill(Me.northwindDataSet.Territories)
Me.regionTableAdapter.Fill(Me.northwindDataSet.Region)
filteredTerritoriesBS = New BindingSource()
Dim dv As New DataView(northwindDataSet.Tables("Territories"))
filteredTerritoriesBS.DataSource = dv
End Sub
Private Sub dataGridView1_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
If e.ColumnIndex = territoryComboBoxColumn.Index Then
Dim dgcb As DataGridViewComboBoxCell = DirectCast(dataGridView1(e.ColumnIndex, e.RowIndex), DataGridViewComboBoxCell)
dgcb.DataSource = filteredTerritoriesBS
Me.filteredTerritoriesBS.Filter = "RegionID = " & Me.dataGridView1(e.ColumnIndex - 1, e.RowIndex).Value.ToString()
End If
End Sub
Private Sub dataGridView1_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs)
If e.ColumnIndex = Me.territoryComboBoxColumn.Index Then
Dim dgcb As DataGridViewComboBoxCell = DirectCast(dataGridView1(e.ColumnIndex, e.RowIndex), DataGridViewComboBoxCell)
dgcb.DataSource = territoriesBindingSource
Me.filteredTerritoriesBS.RemoveFilter()
End If
End Sub
3)Based on this sample code and my example, Can anyone guide me please what will I need to change for the "Location" Combo (Parent), and what for my "Products" combo (Child), and where I need to specify The two DataSources??
I Appreciate any help, with your help we all can become professional Developers!!