Visual Programming

  Visual Basic Exercise

Validating User Input

Number Textbox
Whole Number Textbox
Specific Length Textbox
String Textbox


Number Textbox

~~Exercise 1~~

This type of textbox should allow numbers of any type. This includes whole numbers and floating point numbers.

Type some input into the textbox. Choose if you think it will be considered valid or invalid for a Number Textbox . Then click Test My Input to see if you are correct.

 
 

   
 
   

~~Exercise 2~~

For each input listed below, choose if you think it is valid or invalid for the Number Textbox above. Then click Submit to check all your answers.

  Input Result (choose)
  abc


     
  #12    
     
  12.3
     
  -6
     
  0.035
   

 

Whole Number Textbox

~~Exercise 1~~

This type of textbox should allow whole numbers of only. It should reject floating point numbers and everything else.

Type some input into the textbox. Choose if you think it will be considered valid or invalid for a Whole Number Textbox. Then click Test My Input to see if you are correct.

 
 

   
 

~~Exercise 2~~

For each input listed below, choose if you think it is valid or invalid for the Whole Number Textbox above. Then click Submit to check all your answers.

  Input Result (choose)
  abc


     
  #12    
     
  12.3
     
  -6
     
  2000
   

 

Specific Length Textbox

~~Exercise 1~~

This type of textbox will allow any input provided a specific number of characters have been entered. This is useful where you require input of a specific length - an ID field for example.

In the textbox below I have decided that you have to enter exactly 7 characters. It should reject input where the number of characters is less than or greater than 7.

Type some input into the textbox. Choose if you think it will be considered valid or invalid for a Specific Length Textbox. Then click Test My Input to see if you are correct.

 
 

   
 

~~Exercise 2~~

For each input listed below, choose if you think it is valid or invalid for the Specific Length Textbox above. Then click Submit to check all your answers.

  Input Result (choose)
  abcdefg


     
  #12@111    
     
  12.3
     
  123456
     
  0.00001
   

 

String Textbox

~~Exercise 1~~

This type of textbox will allow any input; i.e. numbers, characters, both. The only thing it will not allow is an empty textbox.

Type some input into the textbox. Choose if you think it will be considered valid or invalid for a String Textbox. Then click Test My Input to see if you are correct.

 
 

   
 

~~Exercise 2~~

For each input listed below, choose if you think it is valid or invalid for the String Textbox above. Then click Submit to check all your answers.

  Input Result (choose)
  abcdefg


     
  #12@111    
     
  12.3
     
  123456
     
  0.00001
   

 

 


Fini
 

 

 

   

  Unit Information

Assessment

Syllabus

Scheme of Work

Notes &Tutorials

Assignments

Quizzes

Books & Things

Links

ADR 2002