Acually what i am trying to do is that
I have 3 items in datagridview
1. course
2. venue
3. schedule
all 3 r combo's
on selection of course i have to add values to
venue combobox in datagridview.
on selection of venue add values to
schedule combobox
This is code i am using
---------------------------------------------
Private Sub mygridview_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles mygridview.CellValueChanged
Try
Dim ColumnIndex, RowIndex, RowValue
ColumnIndex = mygridview.CurrentCell.ColumnIndex
'MsgBox(ColumnIndex)
RowIndex = CStr(mygridview.CurrentCell.RowIndex)
RowValue = CStr(mygridview.CurrentCell.Value)
MsgBox(RowIndex + RowValue)
'Dim s As String = CStr(mygridview.Rows(RowIndex).Cells("course").Value)
s = "select distinct venue from cvs1 where course='" + RowValue + "' "
'MsgBox(s)
''and enrolno ='" + txtenrolno.Text + "'"
cmd = New System.Data.OleDb.OleDbCommand(s, cn)
rs = cmd.ExecuteReader()
While (rs.Read())
MsgBox(rs.GetValue(0))
' mygridview.Item(1, 0) = rs.GetValue(0)
mygridview.Rows(RowIndex).Cells(1).Value() = rs.GetValue(0)
'mygridview.Item(mygridview(1, cnt), ColumnIndex + 1) = rs(0)
'MsgBox(a)
'mygridview.Rows(RowIndex).Cells("venue") = rs(0)
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
-----------------------------
Please do correct the code & answer to above