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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB6....Nul value in text box

Reply to Message Icon

Original Message
Name: gardenair
Date: February 13, 2003 at 22:20:48 Pacific
Subject: VB6....Nul value in text box
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


Report Offensive Message For Removal


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

you can change your if statement with

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

end if



Report Offensive Follow Up For Removal

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

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

borelli34


Report Offensive Follow Up For Removal







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








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software