Email Validation using VB6

Last month, I had discussed already in on how to make a program that can validate or determine whether an inputted email address is true or not. Now, i have here a different version of email validation written in VB 6.0. strong>Now, let's start this tutorial! 1.Let's start this tutorial by following the following steps in Microsoft Visual Basic 6.0: Open Microsoft Visual Basic 6.0, click Choose Standard EXE, and click Open. 2. Next, add only one Button named Command1 and labeled it as "Validate" for determining the validity of the email. Add textbox named Text1 that will serve as your inputted text as email and a Label named Label1 for displaying the Boolean output of the label. You must design your interface like this: design 3. Create a function named isEmail as Boolean that has parameter as variable email As String.Put this code in your code module.
  1. Public Function isEmail(email As String) As Boolean
  2. Dim At As Integer
  3. Dim oneDot As Integer
  4. Dim twoDots As Integer
  6. isEmail = True
  7. At = InStr(1, email, "@", vbTextCompare)
  8. oneDot = InStr(At + 2, email, ".", vbTextCompare)
  9. twoDots = InStr(At + 2, email, "..", vbTextCompare)
  10. If At = 0 Or oneDot = 0 Or Not twoDots = 0 Or Right(email, 1) = "." Then isEmail = False
  11. End Function
Explanation: We created a function named isEmail as Boolean to determine the validity of the email. We have the condition that isEmail is equal to true of it will have '@', a dot '.', or two dots '..' as we have the below lines of code.
  1. At = InStr(1, email, "@", vbTextCompare)
  2. oneDot = InStr(At + 2, email, ".", vbTextCompare)
  3. twoDots = InStr(At + 2, email, "..", vbTextCompare)
- The ‚ÄčInStr function returns a Variant (Long) specifying the position of the first occurrence of one string within another. Syntax: InStr([start, ]string1, string2[, compare])
  • start. Numeric expression that sets the starting position for each search. The first character position is position 1. If this argument is omitted, search starts at the first character position.
  • string1. String expression being searched.
  • string2. String expression searched for.
  • compare. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values. If this argument is omitted, a binary comparison is performed.
Otherwise, if it cannot meet the requirements, email is invalid.


Valid Email outputInvalid Email output Download the source code and try it! :) For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: Visit and like my page on Facebook at:

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
16 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.