tech/music/movies/musings
Show MenuHide Menu

Tag: vb6

Runtime Error 429: Activex Componenent Can’t Create Object

December 2, 2010

Received this error when running a VB6 program that uses DAO on Windows Server 2003 that ran perfectly on Windows XP? Turns out that Windows 2003 has to use DAO 3.6 not 3.51 and importantly will still run on Windows XP.

Validate email address in VB6

September 17, 2010

Nice little function for validating email addresses in VB6 by Brad Murray

Reference: http://www.freevbcode.com/ShowCode.Asp?ID=201

Function IsValidEmail(sEMail As String) As Boolean
    ‘ original by Brad Murray
    ‘ optimized by Rob Hofker, email: rob@eurocamp.nl,
     ’23 august 2000
   
    Dim sInvalidChars As String
    Dim bTemp As Boolean
    Dim i As Integer
    Dim sTemp As String

    ‘ Disallowed characters
    sInvalidChars = “!#$%^&*()=+{}[]|\;:’/?>,< “

    ‘ Check that there is at least one ‘@’
    bTemp = InStr(sEMail, “@”) <= 0
    If bTemp Then GoTo exit_function

    ‘ Check that there is at least one ‘.’
    bTemp = InStr(sEMail, “.”) <= 0
    If bTemp Then GoTo exit_function

    ‘ and that the length is at least six (a@a.ca)
    bTemp = Len(sEMail) < 6
    If bTemp Then GoTo exit_function

    ‘ Check that there is only one ‘@’
    i = InStr(sEMail, “@”)
    sTemp = Mid(sEMail, i + 1)
    bTemp = InStr(sTemp, “@”) > 0
   
    If bTemp Then GoTo exit_function
    ‘extra checks
    ‘ AFTER ‘@’ space is not allowed
    bTemp = InStr(sTemp, ” “) > 0
    If bTemp Then GoTo exit_function

    ‘ Check that there is one dot AFTER ‘@’
    bTemp = InStr(sTemp, “.”) = 0
    If bTemp Then GoTo exit_function
   
    ‘ Check if there’s a quote (“)
    bTemp = InStr(sEMail, Chr(34)) > 0
    If bTemp Then GoTo exit_function
   
       
    ‘ Check if there’s any other disallowed chars
    ‘ optimize a little if sEmail longer than sInvalidChars
    ‘ check the other way around
    If Len(sEMail) > Len(sInvalidChars) Then
        For i = 1 To Len(sInvalidChars)
            If InStr(sEMail, Mid(sInvalidChars, i, 1)) > 0 _
                  Then bTemp = True
            If bTemp Then Exit For
        Next
    Else
        For i = 1 To Len(sEMail)
            If InStr(sInvalidChars, Mid(sEMail, i, 1)) > 0 _
                   Then bTemp = True
            If bTemp Then Exit For
        Next
    End If
    If bTemp Then GoTo exit_function
   
    ‘ extra check
    ‘ no two consecutive dots
    bTemp = InStr(sEMail, “..”) > 0
    If bTemp Then GoTo exit_function
   
exit_function:
    ‘ if any of the above are true, invalid e-mail
    IsValidEmail = Not bTemp

End Function

VB6 Code Samples

August 19, 2010

Found this really useful site by Karl E. Peterson: http://vb.mvps.org/samples/

 

VB6 versus VB.net: Differences

June 21, 2010

 

 

http://visualbasic.about.com/od/imhoinmyhumbleopinion/ss/FiveChanges_3.htm

 

Using Command Line Arguments in VB6

February 18, 2010

 

 

http://www.devx.com/getHelpOn/10MinuteSolution/20366