I am designing a gym system for a college project and i am having problems configuring a rowfiler on a dataview for a data grid on one of my forms.
I will try to describe the problem as best i can.
The screen image displays a form with 2 combo boxes and three groupBoxes.
I am using the first comboBox (cboCID) to control the data in the first groupBox, this will cycle through the client records according to the CID.
I also want the combo box to work on the third groupBox to filter the records that appear. I wish to do this by relating the ID in the cboCID to the id in the datagrid in the third row, showing only the records which match the CID in the comboBox.
I have been working on some code but have hit a wall as i havent delt with the rowFilter function before.
cboCID Code
The first part of the If statement appears to work as the Ids are loaded in to the combo box at form load. however filtering the rows has given me some trouble.
Any help would be greatly appreciated
I will try to describe the problem as best i can.
The screen image displays a form with 2 combo boxes and three groupBoxes.
I am using the first comboBox (cboCID) to control the data in the first groupBox, this will cycle through the client records according to the CID.
I also want the combo box to work on the third groupBox to filter the records that appear. I wish to do this by relating the ID in the cboCID to the id in the datagrid in the third row, showing only the records which match the CID in the comboBox.
I have been working on some code but have hit a wall as i havent delt with the rowFilter function before.
cboCID Code
VB.NET:
Private Sub cboCID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCID.SelectedIndexChanged
Me.TblClientBindingSource.MoveFirst()
Dim index As Integer
For index = 1 To cboCID.SelectedIndex
Me.TblClientBindingSource.MoveNext()
Next
Dim DV_CP As DataView = New DataView(DsGT2000New.tblClientProgramme)
[B] If cboCID.SelectedIndex = "-1" Then
DV_CP.RowFilter = "[CID] = like '*'"
Else
DV_CP.RowFilter = "[CID] = 'cboCID.SelectedItem'"
End If
[/B]
Me.DGV_CP.DataSource = DV_CP
DGV_CP.Refresh()
End Sub
The first part of the If statement appears to work as the Ids are loaded in to the combo box at form load. however filtering the rows has given me some trouble.
Any help would be greatly appreciated