ASCII Codes and Regex Validations

In this lesson we show how to use ASCII Codes to do Input Validation for Numbers and Strings. We then show a second method of Validation used for Phone Numbers and Email Addresses called "Regex Pattern Matching".

If you check the Lesson Contents further down on this page, it is essentially three lessons rolled into one. So we suggest you do the three lessons one at a time so that the workload is not too overwhelming.

Lesson10_Slide01

 

Making use of ASCII Code Numbers makes checking for Letters or Numbers much more compact and simpler than trying to check for each of the letters of the alphabet separately; or having ten separate checks for the Digits 0 through 9.

Lesson10_Slide02

The Step by Step Guide which is available below for this lesson shows exactly what needs to be done.
Also included are all of the Design Principles and Theory behind what is being done at each stage of input validation and String, Loop, and Substring Validation processing. 

Lesson10_Slide03
Lesson10_Slide04

Note that the example Lesson Images shown on this web page are basic Printscreens, whereas the actual original Images are of perfect clarity and quality in the downloadable PDF Guide for this lesson.

 

LESSON OVERVIEW

This lesson consists of a Video Presentation where we cover the following THREE Validation Lessons:

- Lesson Intro and Overview
- Strings and Substrings Explanation and Examples
- ASCII Codes - What they are and Why we use them

LESSON A - KEY PRESS ASCII CODES VALIDATION

- Using the "KEY PRESS" event to do immediate checking as the User types each character into a Text Box
- How to Create the Key Press Event for a Text Box
- Program Code and Testing for the Key Press Subroutine
- Alternative Key Press Validation with TOOL TIP message
- Program Code for Tool Tip Message for Validation Errors
- Validating Key Press Number Values using ASCII Codes
- Program Code for Number Digits Validation

LESSON B - WHOLE STRING ASCII CODES VALIDATIONS

- What is Whole String Validation - Detailed Explanation
- Setting up the Screen Form for Customer ID
- Program Code for the Customer ID Validation
- Using the "Character Casing" Property to make Upper Case Letters
- Using the "Max Length" Property to limit Customer ID to 11 Characters
- Blank Text Box Program Crashing Problems
- Fixing the Program Crashing Problem with Existence Checking
- Checking that all 11 characters have been entered into Customer ID
- Quick Review of "Existence", "Type" and "Range" Validation Checking
- Testing the Validations for Blanks, Character 1 value, and Length.
- Checking that Characters 2 to 8 are Letters or Spaces (For Next Loop)
- Pseudocode of the For Next Loop Checking to work out the Logic
- Program Code for doing the Loop Checking of Customer ID
- Testing the Positions 1 to 7 Validation Checking
- Final Validation Check - 3 digit number ending on Customer ID
- Testing the 3 Digit Ending Validation
- Giving Update Success Message for Passing all 5 Validations
- Notes about being careful when validating People's Names

LESSON C - REGEX REGULAR EXPRESSIONS PATTERN MATCHING VALIDATIONS

- Using a Regex Pattern to Validate a Phone Number
- How to Code the Regex Pattern Matching
- Using Regex Pattern Validation for Email Addresses
- Adding an Email Text Box onto the Form
- Regex Program Code for Validating Email Addresses
- Testing the Email validation
- VB and C# Microsoft Regular Expressions for Modifying String Data

LESSON WRAP UP

- Why we have to learn many Different Programming Languages
- Full Programming Course Website
- Video Wrap Up and Outro

Watch the following YouTube Video Tutorial about ASCII and Regex Validations.
 
We recommend you use the RESOURCE MATERIALS available below
to follow along step by step with the Tutorial Video.

The YouTube Video is free to watch as many times as you want, and the Lesson Summary Guide, with a Step By Step Guide which includes full program code listing(s) are available at a small cost which can be paid for and downloaded using PayPal.

Before purchasing and downloading the following resources, check first with your Teacher or Instructor, as they may already have copies of these documents to give to you.

Our Programming Learning Modules are designed for complete beginners, and they have been extensively trialled with High School students learning Programming for the first time. They have a proven track record of being able to get everyone up and running with Microsoft Visual Basic - the world's most popular Beginner Programmer's language.

We highly recommend using the Step by Step Summary Guide as well as the other support materials to maximise learning outcomes.

Our students have found the Summary Guide to be far more useful than re-watching the Video, when it comes time for them to apply their newly acquired skills to Application Build tasks.

Prices for the Resource Package including the Guide, Form Design, and full Program Code Listings are:

A Single Computer Licence for Personal Use is $AUD 2.50 (Approx $US 1.88).

A Site Licence for Business or Education Training for up to 30 people is $AUD 5.30 (Approx $US 3.97).

Licence Documentation will be included in your Downloads.

Click the appropriate PayPal Button below to be taken to PayPal's secured Gateway and complete your purchase. 

The Transaction will be labelled on your PayPal Statement as "PASSYTUTES", and upon payment completion you need to click the PayPal option to "RETURN TO SELLER'S WEBSITE".  (THIS IS VERY IMPORTANT AS SELECTING THE "RETURN TO SELLER'S WEBSITE" OPTION TAKES YOU THROUGH TO OUR SECURE DOWNLOADS PAGE.)
On the Downloads Page you will be able to easily and directly Download your purchased Digital Products.

If you experience any problems please email us immediately at:

EmailAddressV2PNG.fw

One known issue is that if you PayPal buy using Mircosoft Edge, it often displays prices with A's around them like: A$2.50A.
The Edge purchase will work okay, but it is probably best to do Pay Pal purchases using Google Chrome as your browser.

    Get Single Computer Licence Downloads

        Get 30 Computer Licence Downloads