Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 3rd, 2004, 12:36 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default string validation

Hi,

As part of a program I am making I need to validate a an e-mail address to ensure it contains no spaces, 1 "@" symbol and 3 "." symbols.

I've racking my brains and scowering the net for a solution but to no avail.

Please can anyone help me with this vexing problem?

Many thanks,

John.
 
Old March 3rd, 2004, 12:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

use something like this to validate the string..

if yourstring like "*@*.*.*.*" then
    'going ok.. let's check the spaces
    if instr(1,yourstring," ",vbTextCompare ) = 0 then
        'everything is ok
    else
        'space found
    endif
else
    'wrong format...
endif

Gonzalo Bianchi
 
Old March 3rd, 2004, 01:08 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Gonzalo Bianchi,

A brilliant solution that meets my need perfectly.

 
Old March 3rd, 2004, 01:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

no problem.. the only thing that i have to warn you about is that not all the e-mail adrress has the same count of "." in there.. that's depends of the server address...


Gonzalo Bianchi





Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Date Validation from String iceandrews XSLT 4 May 14th, 2008 07:25 AM
Validation using Validation Framework kalyangvd Struts 1 January 2nd, 2008 06:53 AM
checking string length for form validation Tachyon Beginning PHP 1 June 14th, 2004 08:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.