Versaiteis
Member
- Joined
- Mar 12, 2010
- Messages
- 14
- Programming Experience
- 1-3
Alright, so here's another problem I'm having
What I have is a separate form to delete a record from the database. This form will be used so the user can select the record that they wish to delete via a combo box. When the Record is selected in the combo box a data grid view control below displays the record that the user selected.
My problem is that when the user selects the record the data grid view displays the entire dataset (and therefore the entire database) rather than just the single record.
Heres the code:
Of course I realize that it the above could be simplified to read me.dgvRecord.DataSource=Main.ds.Tables("Clients").Rows(Me.cboRecord.SelectedIndex) but I did that to better "see" it
What I have is a separate form to delete a record from the database. This form will be used so the user can select the record that they wish to delete via a combo box. When the Record is selected in the combo box a data grid view control below displays the record that the user selected.
My problem is that when the user selects the record the data grid view displays the entire dataset (and therefore the entire database) rather than just the single record.
Heres the code:
VB.NET:
Private Sub cboRecord_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboRecord.SelectedIndexChanged
Dim dbRow As Data.DataRow
Select Case cboType.Text
Case "Client"
dbRow= Main.ds.Tables("Clients").Rows(Me.cboRecord.SelectedIndex)
Me.dgvRecord.DataSource = dbRow
Case "Equipment"
Case "Supply"
Case "Garment"
End Select
End Sub
Of course I realize that it the above could be simplified to read me.dgvRecord.DataSource=Main.ds.Tables("Clients").Rows(Me.cboRecord.SelectedIndex) but I did that to better "see" it