I'm currently working with a datagridview on a windows application. I have two specific columns which will work alongside each other. For simplicity, column 1 is used to select a license number, column 2 is used to select a licensed name (both of these columns are combo-box columns). When the end-user selects a name, I'm loading the license number combo-box with a data-set according to the ID of the person selected, for that particular row. This will load any license number(s) assigned to that specific person. While testing my code, the data-set loads correctly according to the person selected. Issue: The datagridview wants to load
every row in column 1 with that specific data-set. I would like to have this data-set load column 1 only for the
specific row number which the end-user is currently working with.
My code I'm currently testing with:
Private Sub grdvwDeposit_CellValueChanged(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
Handles grdvwDeposit.CellValueChanged
If IsComboBoxCell(e) Then
If e.ColumnIndex = 2 Then
Call SetLicenseComboBoxes(e)
End If
End If
End Sub
Private Sub SetLicenseComboBoxes(ByVal e As DataGridViewCellEventArgs)
Dim intVal As Integer
Dim objWork As Object = Nothing
Dim cur_cell As DataGridViewCell = Me.grdvwDeposit.CurrentCell
Dim row As Integer = cur_cell.RowIndex
Dim col As Integer = cur_cell.ColumnIndex
If Me.grdvwDeposit.CurrentCell.ColumnIndex = 2 Then
objWork = Me.grdvwDeposit.Rows(row).Cells(col).Value
If IsNumeric(objWork) Then
intVal = CInt(objWork)
Else
Exit Sub
End If
Dim intRow As Integer = row
Do Until intRow = row - 1
Call FillDataSet(mdsLicenseSpecific,
"usp_tblTransaction_Grid_License_FillComboBox_Specific",
"@ID_Person", intVal)
Try
Call FillMassTransactionGridViewComboBoxFromDataset
(Me.grdvwDeposit.Rows(row),
Me.grdvwDeposit.Columns(1),
mdsLicenseSpecific)
Catch ex As Exception
MessageBox.Show(ex.ToString, gstrAppName,
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
intRow -= 1
Loop
Exit Sub
End If
End Sub
In my 'Do-Until' code, you can see that I'm loading a specific row and column, according to the current row being used. Any suggestions would be greatly appreciated.
Thanks,
GoBrvs01