Computing.Net > Forums > Programming > VB6....Nul value in text box

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB6....Nul value in text box

Reply to Message Icon

Name: gardenair
Date: February 13, 2003 at 22:20:48 Pacific
OS: win98
CPU/Ram: 166
Comment:

I have two text boxes in Visual Basic6 .How can i restrict the user
if he press enter key in the text box to switch to next text box when Text1 is enpty . NUL value...
My code is as under please can you tell me how can i change it if
the the user press enter key without input in the text box1.

Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then ' For Enter key
Text2.Enabled = True
Text2.SetFocus ' Cursor will move to text2
KeyAscii = 0 ' Eliminating the Beep from System Speaker
Exit Sub
Else
KeyAscii = 0
Beep
End If
End Sub



Sponsored Link
Ads by Google

Response Number 1
Name: Aamir Noman
Date: February 13, 2003 at 22:58:05 Pacific
Reply:

you can change your if statement with

if keyascii=13 and text1.text "" then
Text2.Enabled = True
Text2.SetFocus

end if



0

Response Number 2
Name: borelli34
Date: February 15, 2003 at 10:35:58 Pacific
Reply:

note: this is assuming that text2.enabled has already been set to false.

borelli34


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB6....Nul value in text box

VB6.......Dead Lock in Text Boxes www.computing.net/answers/programming/vb6dead-lock-in-text-boxes/5508.html

help with vb6 text box www.computing.net/answers/programming/help-with-vb6-text-box/7509.html

Adding value in Combobox www.computing.net/answers/programming/adding-value-in-combobox/10055.html