Results 1 to 2 of 2

Thread: I want the code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2002
    Posts
    17

    I want the code

    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

  2. #2
    Lively Member jalopez's Avatar
    Join Date
    Jul 2001
    Location
    Puerto Rico
    Posts
    108

    Wink Here is your code...

    Try something like this!


    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!

    Juan
    ======================
    A computer can be a tool, a toy or a weapon, it just depends on who uses it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width