Search code examples
vb6activexocx

HOW to solve "Compile error: Type mismatch" with own file ocx in VB6


I have an ActiveX named GridEntry.ocx I found it from the download link GridEntry.ocx

I want to use it to make a software. but I'm having trouble, and getting an error message. "Compile error: Type mismatch" my code

Private Sub GridEntry1_KeyPress(KeyAscii As Integer, Row As Integer, Col As Byte)
If KeyAscii = 13 Then
Post = GridEntry1.CellFocus(0, 1)
 With GridEntry1
  .Caption = "TEST"
  End With
End If
End Sub

Solution

  • Use this

    Private Sub GridEntry1_KeyPress(KeyAscii As Integer, Row As Integer, Col As Byte)
    If KeyAscii = 13 Then
    Call  GridEntry1.CellFocus(0, 1)
     With GridEntry1
      .Caption = "TEST"
      End With
    End If
    End Sub