By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,798 Members | 1,378 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,798 IT Pros & Developers. It's quick & easy.

help with keypress enter...

P: 16
Please help me with enter.. :) I like when i'm enter value on 1 text box,and when i press enter to go on second text box and when i write value i like to press again enter key and txt3.text=val(txt1.text)*val(txt2.text)... Please help me what i must write in code for this
Apr 2 '07 #1
Share this Question
Share on Google+
9 Replies


SammyB
Expert 100+
P: 807
Please help me with enter.. :) I like when i'm enter value on 1 text box,and when i press enter to go on second text box and when i write value i like to press again enter key and txt3.text=val(txt1.text)*val(txt2.text)... Please help me what i must write in code for this
What VB are you using? VBA (if so, for what application), VB6.0, or VB.NET?
Apr 2 '07 #2

iburyak
Expert 100+
P: 1,017
I assume you use VB6 if not adjust this code:


[PHP]Option Explicit

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Text2.SetFocus
End If
End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End If
End Sub[/PHP]
Apr 2 '07 #3

P: 16
I assume you use VB6 if not adjust this code:


[PHP]Option Explicit

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Text2.SetFocus
End If
End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End If
End Sub[/PHP]
Well Thanky for this but i try and it not work again... if you have some another sugestion please write me i'm waiting..
Apr 3 '07 #4

P: 16
What VB are you using? VBA (if so, for what application), VB6.0, or VB.NET?
i'm working in VB 6
Apr 3 '07 #5

vijaydiwakar
100+
P: 579
I assume you use VB6 if not adjust this code:


[PHP]Option Explicit

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Text2.SetFocus
End If
End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End If
End Sub[/PHP]
what's the problem in the code?
Apr 3 '07 #6

P: 16
what's the problem in the code?
well go on next text box but (txt3.text) but not show value for txt2.text * txt1.text
Apr 3 '07 #7

vijaydiwakar
100+
P: 579
well go on next text box but (txt3.text) but not show value for txt2.text * txt1.text
Not Cleared......?
Apr 3 '07 #8

P: 16
i dont know how to tell you...in first form.. I have 1 combo box and 3 text boxes and one button. first text box is for const which i choose from combobox and second is for my value... when i press enter go on first to second text box but when i press enter again go on textbox 3 which i like to be protected and when i press enter automatic show value for txt1 * txt2 ... Do you anderstand me... for key enter i'm writing this..
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
KeyAscii = 0
End If
End Sub
Apr 3 '07 #9

vijaydiwakar
100+
P: 579
i dont know how to tell you...in first form.. I have 1 combo box and 3 text boxes and one button. first text box is for const which i choose from combobox and second is for my value... when i press enter go on first to second text box but when i press enter again go on textbox 3 which i like to be protected and when i press enter automatic show value for txt1 * txt2 ... Do you anderstand me... for key enter i'm writing this..
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
KeyAscii = 0
End If
End Sub
make keypreview of form to true
then use the multiplication code in text3 validate event
Apr 3 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.