Hi,
DataGrid1 consists of 5 columns. i want to translate the following 2 sentences into proper VB6 code:
if I Getfocus on any cell of column1 Then Label1 = A1
if I Getfocus on any cell of column2 Then Label1 = A2
Thanks
Printable View
Hi,
DataGrid1 consists of 5 columns. i want to translate the following 2 sentences into proper VB6 code:
if I Getfocus on any cell of column1 Then Label1 = A1
if I Getfocus on any cell of column2 Then Label1 = A2
Thanks
Try something like this!
:D
Private Sub DBGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If DBGrid1.Col = 1 Then
Label1.Caption = "A1"
ElseIf DBGrid1.Col = 2 Then
Label1.Caption = "A2"
Else
Label1.Caption = "None"
End If
End Sub
Remember this sample code is true if you are using any data grid control. You must place the code in the DBGrid1_RowColChange event of the data grid.
Hope it helps!
:cool: