Click here to Skip to main content
15,925,399 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: chdir code fails at run time Pin
thandal19-Apr-06 19:58
thandal19-Apr-06 19:58 
Questionhi reading xl file Pin
sudharsong18-Apr-06 19:14
sudharsong18-Apr-06 19:14 
QuestionHow to read and write database(SQL Sever) from text and reverse Pin
donle198118-Apr-06 18:13
donle198118-Apr-06 18:13 
AnswerRe: How to read and write database(SQL Sever) from text and reverse Pin
Steve Pullan18-Apr-06 18:53
Steve Pullan18-Apr-06 18:53 
AnswerRe: How to read and write database(SQL Sever) from text and reverse Pin
Duncan Edwards Jones18-Apr-06 20:58
professionalDuncan Edwards Jones18-Apr-06 20:58 
QuestionNeed a good Email Validator function...Help me out! Pin
Amir K118-Apr-06 17:53
Amir K118-Apr-06 17:53 
AnswerRe: Need a good Email Validator function...Help me out! Pin
Dave Kreskowiak19-Apr-06 1:38
mveDave Kreskowiak19-Apr-06 1:38 
GeneralRe: Need a good Email Validator function...Help me out! Pin
Amir K119-Apr-06 6:30
Amir K119-Apr-06 6:30 
Dear Dave,
What exactly im looking for is a function in VB .NET to validate an email address inserted into a textbox in windows application forms.
I surfed the web and I found the following code :

Function ValidEmail(ByVal strCheck As String) As Boolean

Dim bCK As Boolean
Dim strDomainType As String
Dim strDomainName As String
Const sInvalidChars As String = "!#$%^&*()=+{}[]|\;:'/?>,< "
Dim i As Integer

bCK = Not InStr(1, strCheck, Chr(34)) > 0 'Check to see if there is a double quote
If Not bCK Then GoTo ExitFunction

bCK = Not InStr(1, strCheck, "..") > 0 'Check to see if there are consecutive dots
If Not bCK Then GoTo ExitFunction

' Check for invalid characters.
If Len(strCheck) > Len(sInvalidChars) Then
For i = 1 To Len(sInvalidChars)
If InStr(strCheck, Mid(sInvalidChars, i, 1)) > 0 Then
bCK = False
GoTo ExitFunction
End If
Next
Else
For i = 1 To Len(strCheck)
If InStr(sInvalidChars, Mid(strCheck, i, 1)) > 0 Then
bCK = False
GoTo ExitFunction
End If
Next
End If

If InStr(1, strCheck, "@") > 1 Then 'Check for an @ symbol
bCK = Len(Left(strCheck, InStr(1, strCheck, "@") - 1)) > 0
Else
bCK = False
End If
If Not bCK Then GoTo ExitFunction

strCheck = Right(strCheck, Len(strCheck) - InStr(1, strCheck, "@"))
bCK = Not InStr(1, strCheck, "@") > 0 'Check to see if there are too many @'s
If Not bCK Then GoTo ExitFunction

strDomainType = Right(strCheck, Len(strCheck) - InStr(1, strCheck, "."))
bCK = Len(strDomainType) > 0 And InStr(1, strCheck, ".") < Len(strCheck)
If Not bCK Then GoTo ExitFunction

strCheck = Left(strCheck, Len(strCheck) - Len(strDomainType) - 1)
Do Until InStr(1, strCheck, ".") <= 1
If Len(strCheck) >= InStr(1, strCheck, ".") Then
strCheck = Left(strCheck, Len(strCheck) - (InStr(1, strCheck, ".") - 1))
Else
bCK = False
GoTo ExitFunction
End If
Loop
If strCheck = "." Or Len(strCheck) = 0 Then bCK = False

ExitFunction:
ValidEmail = bCK
End Function

But I when I copy the code in my application LEFT and RIGHT are shown as SYNTAX ERROR,
do I need to IMPORT sth in order to make them recognized?
Regards,
AmirK1
GeneralRe: Need a good Email Validator function...Help me out! Pin
Dave Kreskowiak19-Apr-06 11:34
mveDave Kreskowiak19-Apr-06 11:34 
QuestionCan an array be filled from information in a text file Pin
lawrencef1418-Apr-06 17:18
lawrencef1418-Apr-06 17:18 
AnswerRe: Can an array be filled from information in a text file Pin
Steve Pullan18-Apr-06 18:57
Steve Pullan18-Apr-06 18:57 
GeneralRe: Can an array be filled from information in a text file Pin
lawrencef1419-Apr-06 2:22
lawrencef1419-Apr-06 2:22 
GeneralRe: Can an array be filled from information in a text file Pin
Steve Pullan19-Apr-06 4:32
Steve Pullan19-Apr-06 4:32 
GeneralRe: Can an array be filled from information in a text file Pin
lawrencef1419-Apr-06 6:05
lawrencef1419-Apr-06 6:05 
GeneralRe: Can an array be filled from information in a text file Pin
Steve Pullan19-Apr-06 14:15
Steve Pullan19-Apr-06 14:15 
GeneralRe: Can an array be filled from information in a text file Pin
lawrencef1425-Apr-06 4:14
lawrencef1425-Apr-06 4:14 
Questionmaster..xp_cmdshell command couldn't delete files Pin
jjbhey18-Apr-06 17:13
jjbhey18-Apr-06 17:13 
AnswerRe: master..xp_cmdshell command couldn't delete files Pin
Dave Kreskowiak19-Apr-06 1:42
mveDave Kreskowiak19-Apr-06 1:42 
QuestionDatagrid, DataSet Pin
dannygilbert318-Apr-06 10:59
dannygilbert318-Apr-06 10:59 
QuestionCreate listbox based on contents of table Pin
penguin500018-Apr-06 10:53
penguin500018-Apr-06 10:53 
AnswerRe: Create listbox based on contents of table Pin
Solid Snake18-Apr-06 11:01
Solid Snake18-Apr-06 11:01 
GeneralRe: Create listbox based on contents of table Pin
penguin500018-Apr-06 11:23
penguin500018-Apr-06 11:23 
GeneralRe: Create listbox based on contents of table Pin
Solid Snake18-Apr-06 11:40
Solid Snake18-Apr-06 11:40 
GeneralRe: Create listbox based on contents of table Pin
mr_1234518-Apr-06 13:36
mr_1234518-Apr-06 13:36 
GeneralRe: Create listbox based on contents of table Pin
mr_1234518-Apr-06 16:46
mr_1234518-Apr-06 16:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.