473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help with keypress enter...

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
9 10298
SammyB
807 Expert 512MB
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
1,017 Expert 512MB
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
Jolace
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
Jolace
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
579 512MB
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
Jolace
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
579 512MB
well go on next text box but (txt3.text) but not show value for txt2.text * txt1.text
Not Cleared......?
Apr 3 '07 #8
Jolace
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
579 512MB
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

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

Similar topics

3
by: Randi | last post by:
Hi All, I have a problem on a username password login form. I use: txtPassword.Text = StrConv(txtPassword.Text, vbProperCase) to validate the proper case when someone enters their name and...
6
by: Agency | last post by:
I'm trying to program a utility that counts the beats per minute in a song by tapping the spacebar. I already have a program that does this, but I wanted to make my own. The "enter" key resets the...
7
by: Alex007 | last post by:
Hi, I've been working on this C assignement for a CS course.... the assignement is going pretty well and all my code works well on both Windows and Linux. The only thing that doesn't work is...
2
by: freddy | last post by:
How do I use the Keypress event. So if I hit in the Enter key I went it do someting. like instead of clicking on a button the enter key will fire up the program
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: JAG711 | last post by:
I have 2 mdi childforms which are database input forms. Each form has the usual add/delete/edit/save buttons and a few textboxes. I capture the keypress events on the textboxes to allow only...
1
by: Jim Hubbard | last post by:
Why isn't the Keypress event of the System.Windows.Form.ToolStripComboBox triggered by hitting the Enter key? I cannot trap Keys.Enter or Keys.Return in the Keypress event.
4
by: almurph | last post by:
Hi everyone, I'm a newbie to javascript. I have written some code to detect when a user presses the down-arrow, up-arrow and enter button. Essentially the user can arrow down or up through a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.