Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

KeyUp Declaration

Status
Not open for further replies.

Wantabie

Programmer
Apr 29, 2004
72
0
0
US
I have some code that when i try and run debug it prompts an compile error message:

"Procedure Declaration does not match description of event or procedure having the same name."

The code that it keeps reverting back too is:

 
Sorry, hit the wrong button.

Code that i am using is:

Code:
Private Sub txtHost_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = 40 And Shift = 0 And lstHost.ListIndex < (lstHost.ListCount - 1) Then
        lstHost.ListIndex = lstHost.ListIndex + 1
        txtHost.Text = lstHost.Text
    End If
    
    If KeyCode = 38 And Shift = 0 And lstHost.ListIndex > 0 Then
        lstHost.ListIndex = lstHost.ListIndex - 1
        txtHost.Text = lstHost.Text
        txtHost.SelStart = Len(txtHost.Text)
    End If
End Sub

Can any help?
 
Is "txtHost" an array of text boxes? If so you need
Code:
Private Sub txtHost_KeyUp([b]Index As Integer,[/b] KeyCode As Integer, Shift As Integer)
 
The name "txtHost" is a textbox. I did, however, try implementing your suggestion

Code:
Private Sub txtHost_KeyUp(Index As Integer, KeyCode As Integer, Shift As Integer)

and got the same result...
 
Figured out what the compiler was looking for.

Code:
Private Sub txtHost_KeyUp([b]ByVal[/b] KeyCode As [b]MSForms.ReturnInteger[/b], [b]ByVal[/b] Shift As Integer)

Go figure...

Thnaks for any suggestions

Wantabie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top