PRB: TextBox not recognizing KeyAscii 13

this is so weird, i have the exact same code in 2 projects, and in one, when u press enter in the textbox, the text_KeyPress KeyAscii is triggered with ascii value being 13, and in the other project, pressing Enter does absolutely nothing!
This is the code.: In project 1: Works!

Private Sub txtSend_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 38 Then
If dacurrentIndex >= iCounter Then
Exit Sub
End If
dacurrentIndex = dacurrentIndex + 1
txtSend.Text = s_MsgRecall(iCounter - dacurrentIndex)
txtSend.SelStart = Len(txt) + 1
SendKeys "{DEL}"
End If
If KeyCode = 40 Then
If dacurrentIndex <= 0 Then
Exit Sub
End If
dacurrentIndex = dacurrentIndex - 1
txtSend.Text = s_MsgRecall(iCounter - dacurrentIndex) & Space(1)
txtSend.SelStart = Len(txt) + 1
SendKeys "{BS}"
End If
'38 = up
'40 = down
End Sub

Private Sub txtSend_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtSend = "" Then
        Exit Sub
    End If
    SendKeys Chr(8)
    Call cmdSend_Click
End If
End Sub

-----------
This code is in Proj. 2, DOESNT WORK WHEN ENTER IS PRESSED.
I put this line of code in the KeyDown and KeyPress events to see if they are even called and this is the code i put in: "MsgBox KeyCode", and "MsgBox KeyAscii" respectivly. It doesnt even call the messagebox. (i put breakpoints and both KeyDown or KeyAscii werent called)
-
I even put the KeyPreview on both Forms to True and False, it worked on Project 1 with both boolean values. and nothing on Project 2.
I am stumped!
tWiZtEr_RXAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GPrentice00Commented:
in project two, do the keydown and keypress events fire for other keys?  Did you copy the code inside the events into the project2 events, or did you copy the whole code from the Private Sub...End Sub?  I've done that before for simplicity, but had misspelled my control name in the new project, and thus TxtGeneSeq_events in my code were never going to be fired for the TxtGenSeq textbox...

0
tWiZtEr_RXAuthor Commented:
Ya, KeyDown and KeyPress are triggered by other keys, even Control+Enter, (with KeyCode, it tells me that Control was pressed, then the next message box is 13(or enter),) but under no other situations (that i have found yet) can the event be triggered by Enter. And for sure hasnt been able to be triggered on its own (just pressing Enter).
and no, this is a Server and Client Project, so i didnt copy the hole code. But the textbox control was copied from the Project1(Client, the one that works), so it has same properties, and the same code is on the txtSend_KeyPress and txtSend_KeyDown because they are both called txtSend in both Projects. im so stumped.
0
AzraSoundCommented:
The only thing that comes to mind is that you have a command button on your form in Project2 that has its Default property set to True.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

tWiZtEr_RXAuthor Commented:
i will quadruple check
0
tWiZtEr_RXAuthor Commented:
THANKS SO MUCH, i expanded my form becuze i had some out of sight, and one that i copied from another program was set to Default=True!
Thanks - cant believe i overlooked the ones i couldnt see (lol :P)
0
tWiZtEr_RXAuthor Commented:
-- danke schon AzraSound
0
AzraSoundCommented:
Glad I could help  :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.