|
-
May 11th, 2007, 02:54 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] problem capturing enter key inside frame
I have a textbox inside frame and want to capture enter key using the code below but it never works. I had the same textbox outside frame and it was working !! could any one tell me how to fix this problem?thanks
1 Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
'...YOUR PROCEDURE CALL HERE
Dim variable_abc
variable_abc = Text1.Text
Dim variable_def
variable_def = Text2.Text
Dim variable_ghi
variable_ghi = Text3.Text
'MsgBox "textbox data: " & variable_abc
Dim sHTML As String
Dim sURL As String
'Create URL
sURL = "http://localhost/send.php?sessionkey=" & _
gstrSomething & "&text=" & variable_abc & "&site=" & variable_ghi
sHTML = Inet1.OpenURL(sURL) 'returns page source
MsgBox "textbox data2: " & sURL
Text1.Text = ""
WebBrowser1.Refresh
End If
End Sub
-
May 11th, 2007, 03:07 AM
#2
Re: problem capturing enter key inside frame
try using the KeyDown event of the TextBox instead...
vb Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Text2.Text = Text1.Text
End If
End Sub
-
May 11th, 2007, 03:14 AM
#3
Re: problem capturing enter key inside frame
Keypress on a form? You have to set your form's KeyPreview to True in design time.
-
May 11th, 2007, 07:42 AM
#4
Re: problem capturing enter key inside frame
You posted code for a Form KeyPress but your question is about a textbox keypress.
Which one is giving you the problem?
If it is in a frame, I suspect it is the textbox, correct?
What is in your textboxs keypress event?
-
May 11th, 2007, 08:15 AM
#5
Re: problem capturing enter key inside frame
And i would suggest using....
vb Code:
Text1.Text = vbNullString
instead of
Less memory consuming
-
May 11th, 2007, 12:13 PM
#6
Thread Starter
Frenzied Member
Re: problem capturing enter key inside frame
 Originally Posted by Hack
You posted code for a Form KeyPress but your question is about a textbox keypress.
Which one is giving you the problem?
If it is in a frame, I suspect it is the textbox, correct?
What is in your textboxs keypress event?
Problem solved i rename it to:
Private Sub Text1_KeyPress(KeyAscii As Integer)
instead of :
Private Sub Form_KeyPress(KeyAscii As Integer)
or
Private Sub frame1_KeyPress(KeyAscii As Integer)
Last edited by tony007; May 11th, 2007 at 12:20 PM.
-
May 11th, 2007, 12:25 PM
#7
Re: [RESOLVED] problem capturing enter key inside frame
No renaming should have been necessary. Just code moving from one control to another.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|