473,385 Members | 1,356 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,385 software developers and data experts.

Validating Text Boxes and Focus

I have to do a program that involves validating four text boxes that, when entered, are only supposed to be an integer. If anything but an integer is entered, the focus should not move onto the next text box. This whole procedure has do be done in a single event handler.
Nov 16 '10 #1
1 1003
Guido Geurs
767 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_LostFocus()
  2. ...
  3. ...
  4.    If Not IsNumeric(Text1) Then GoTo Error_String
  5.    If Val(Text1) - Fix(Val(Text1)) <> 0 Then GoTo Error_Integer
  6. ...
  7. ...
  8. Exit Sub
  9. Error_String:
  10.    MsgBox "enter number"
  11.    Text1.SetFocus
  12. Exit Sub
  13. Error_Integer:
  14.    MsgBox "enter integer"
  15.    Text1.SetFocus
  16. End Sub
Nov 18 '10 #2

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

Similar topics

1
by: jerry | last post by:
I am using Visula Basic .Net to create a Web Form with text boxes. I have not found a way to do the following: set the focus on a text box, use the enter key to move from one text box to...
9
by: B-Dog | last post by:
I have a form that has about 10 text boxes on it, they all have to be filled out before submitting is there a quick way to make sure that none are null or do I have to call out each textbox? Say...
2
by: Rajesh | last post by:
I have bunch of textboxs in a form.Now i want ot validate these textboxes.These textboxes i am entering string as well as numeric values.How can i validate string and numeric values? Thanks for...
2
by: Sethos | last post by:
I am sure that this has been covered, hashed, and rehashed, but a search on the group did not produce the answer, so forgive me if this seems like a "newbie" type question... Besically, I have a...
2
by: Peter Newman | last post by:
Firstly i would like to tank the helpful posts in the past regarding formatting... the scenario is that i ahve a form created by the data wizard. I have created a private sub to handle the...
0
by: gav1972 | last post by:
Working on this piece of code but when i click on my add button in the form the text boxes that i am using do not clear and so i can't add a new record any help would be great. The code for my data...
0
by: bobby421 | last post by:
Hi, I have a master page and content page. In content page I have to validate the text boxes for name,address, phone number and email address etc. But as content pages doersn't have html section...
9
by: JShea | last post by:
I have a "Cancel" button on a form that when clicked brings the user back to the previous page where he had entered data into two different text boxes and also had to click a radion button. I can...
2
by: jimatqsi | last post by:
I'm getting "Application-Defined or object-defined error in procedure ..." sometimes, and sometimes not. This happens whenever I try to get the value from one of more of these text boxes on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.