Link to home
Start Free TrialLog in
Avatar of shprakash

asked on

casting problem

I have problem in upgarding vb6 to  the bellow code is taken from after using upgrade wizard

1)Could not solve the default property of object getgetsripnull()... how to solve this issue?
2) When i run this application it gives conversion from string to type short is not valid in this
   intEntries1 = CShort(gStripNull(GetARegistryString(AppName, "entries"))) particular line of code..

Public Function SendEmail(ByRef sMsgSubject As String, ByRef sMsgContent As String) As Boolean
        'This function shells out and runs a standalone EXE that uses SMTP to e-mail a msg
        '   1. Build command line string (delimiters are *+-^~   We will use ~)
        '       We will use the "USER - User Defined", command line method of invoking the utility
        '       a. Input smtp host
        '       b. Email From
        '       c. Email recipient
        '       d. emailCC
        '       e. subject (if passed parm blank)
        '       f. message (if passed parm blank)
        '   2. Shell out
        '   3. Exit
        Dim strCommandLine As String
        Dim fEMailEXEPath As String
        Dim fSMTPServer As String
        Dim fEMailFrom As String
        Dim fEMailSubject As String
        Dim fEMailCC As String
        Dim strEMailTo As String
        Dim strErrorMsg As String
        Dim AppName As String
        Dim KeyName As String
        Dim intSub1 As Short
        Dim intEntries1 As Short
        AppName = "EMail"
        'apb 5/2004 remove this for prod (testing only)
        'sMsgSubject = "TESTING:" + sMsgSubject
        'UPGRADE_WARNING: Couldn't resolve default property of object gStripNull(). Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        intEntries1 = CShort(gStripNull(GetARegistryString(AppName, "entries")))
        If intEntries1 < 1 Then
            sLogEntry = "Problem with the INI file (MCCycle.ini). Processing terminated." & vbNewLine & "Please page 366-0599 for assistance...                    Entries = " & intEntries1
            SendEmail = False
        End If
        intSub1 = 0
        Do Until intSub1 = intEntries1
            intSub1 = intSub1 + 1
            KeyName = "person" & CStr(intSub1)
            ReDim Preserve gEmailList(intSub1)
            gEmailList(intSub1).sendto = GetARegistryString(AppName, KeyName)
        If Left(sLogEntry, 7) = "Problem" Then SendEmail = False
        fEMailEXEPath = GetARegistryString(AppName, "fEMailEXEPath")
        fSMTPServer = GetARegistryString(AppName, "fSMTPServer")
        fEMailFrom = GetARegistryString(AppName, "fEMailFrom")
        fEMailCC = GetARegistryString(AppName, "fEMailCC")
        fEMailSubject = GetARegistryString(AppName, "fEMailSubject")
        intSub1 = 0
        strEMailTo = ""
        Do Until intSub1 = intEntries1
            intSub1 = intSub1 + 1
            strEMailTo = strEMailTo & gEmailList(intSub1).sendto 'e-mail name
            If intSub1 = intEntries1 Then
                strEMailTo = strEMailTo & ";"
            End If
        strCommandLine = fEMailEXEPath & "EMailService.exe ~USER~"
        strCommandLine = strCommandLine & fSMTPServer & "~"
        strCommandLine = strCommandLine & fEMailFrom & "~"
        strCommandLine = strCommandLine & strEMailTo & "~"
        strCommandLine = strCommandLine & fEMailCC & "~"
        strCommandLine = CStr(CDbl(strCommandLine) + IIf(sMsgSubject = "", fEMailSubject, sMsgSubject) + CDbl("~"))
        strCommandLine = CStr(CDbl(strCommandLine) + IIf(sMsgContent = "", gEmailMessage2 & vbCrLf & gEmailMessage, sMsgContent))
        If ShellAndWaitForTermination(strCommandLine, , strErrorMsg) = False Then
            If strErrorMsg <> "" Then
                PrintLine(1, " ")
                PrintLine(1, strErrorMsg)
                PrintLine(1, "Problem in e-mail process: Check e-mail program log file")
            End If
            'GoTo ErrorInProcess
        End If
        SendEmail = True
        Exit Function
        SendEmail = False
        MsgBox("Problem emailing - " & Err.Description)
    End Function

Open in new window

Avatar of talker2004
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial