Results 1 to 10 of 10

Thread: [RESOLVED] vbcrlf and vbnewline problem

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Resolved [RESOLVED] vbcrlf and vbnewline problem

    I have a contact form in my app that sends a email. All information shows but the format is not right. I have tried vbcrlf as well as vbnewline and the format comes out the same. Any ideas?

    My vb code is:
    vb Code:
    1. sMessageBody = "REMINDER: If the end user has requested a reply e-mail, they were promised an e-mail within 48 hours." & vbCrLf & vbCrLf & _
    2.                            "Contact Reason: " & cboContactReason.SelectedItem.ToString & vbCrLf & _
    3.                            "Requires a reply: " & cboReplyBack.SelectedItem.ToString & vbCrLf & vbCrLf & _
    4.                            "E-Mail Message: " & vbCrLf & _
    5.                            txtMessage.Text.Trim & vbCrLf & vbCrLf & _
    6.                            "MACHINE INFORMATION: " & vbCrLf & _
    7.                            "Computer Name: " & My.Computer.Name & vbCrLf & _
    8.                            "Available Physical Memory: " & My.Computer.Info.AvailablePhysicalMemory & vbCrLf & _
    9.                            "Available Virtual Memory: " & My.Computer.Info.AvailableVirtualMemory & vbCrLf & _
    10.                            "Total Physical Memory: " & My.Computer.Info.TotalPhysicalMemory & vbCrLf & _
    11.                            "Total Virtual Memory: " & My.Computer.Info.TotalVirtualMemory & vbCrLf & _
    12.                            "Operating System Full Name: " & My.Computer.Info.OSFullName & vbCrLf & _
    13.                            "Operating System Platform: " & My.Computer.Info.OSPlatform & vbCrLf & _
    14.                            "Operating System Version: " & My.Computer.Info.OSVersion & vbCrLf & vbCrLf & _
    15.                            "APPLICATION INFORMATION: " & vbCrLf & _
    16.                            "Application Name: " & My.Application.Info.ProductName & vbCrLf & _
    17.                            "Common Application Data Path: " & System.Windows.Forms.Application.CommonAppDataPath & vbCrLf & _
    18.                            "Executable Path: " & System.Windows.Forms.Application.ExecutablePath & vbCrLf & _
    19.                            "Local User Application Data Path: " & System.Windows.Forms.Application.LocalUserAppDataPath & vbCrLf & _
    20.                            "Startup Path: " & System.Windows.Forms.Application.StartupPath & vbCrLf & _
    21.                            "User Application Data Path: " & System.Windows.Forms.Application.UserAppDataPath

    The email comes to me like so:
    REMINDER: If the end user has requested a reply e-mail, they were promised an e-mail within 48 hours.

    Contact Reason: Bug Report
    Requires a reply: Yes

    E-Mail Message:
    A

    MACHINE INFORMATION:
    Computer Name: PADDYLAPTOP
    Available Physical Memory: 849801216
    Available Virtual Memory: 1877094400
    Total Physical Memory: 2137186304
    Total Virtual Memory: 2147352576
    Operating System Full Name: Microsoft Windows 7 Professional Operating System Platform: Win32NT Operating System Version: 6.1.7600.0

    APPLICATION INFORMATION:
    Application Name:Support Space Call Tracker Common Application Data Path:C:\ProgramData\Support Space Call Tracker\Support Space Call Tracker\2011.0.0.26 Executable Path:C:\Users\Paddy\Desktop\Visual Basic\SupportSpace\SupportSpaceCallTracker\SupportSpaceCallTracker\bin\x86\Debug\SupportSpaceCallTra cker.EXE
    Local User Application Data Path:C:\Users\Paddy\AppData\Local\Support Space Call Tracker\Support Space Call Tracker\2011.0.0.26 Startup Path:C:\Users\Paddy\Desktop\Visual Basic\SupportSpace\SupportSpaceCallTracker\SupportSpaceCallTracker\bin\x86\Debug
    User Application Data Path:C:\Users\Paddy\AppData\Roaming\Support Space Call Tracker\Support Space Call Tracker\2011.0.0.26
    The email should look like so:
    REMINDER: If the end user has requested a reply e-mail, they were promised an e-mail within 48 hours.

    Contact Reason: Bug Report
    Requires a reply: Yes

    E-Mail Message:
    A

    MACHINE INFORMATION:
    Computer Name: PADDYLAPTOP
    Available Physical Memory: 849801216
    Available Virtual Memory: 1877094400
    Total Physical Memory: 2137186304
    Total Virtual Memory: 2147352576
    Operating System Full Name: Microsoft Windows 7 Professional
    Operating System Platform: Win32NT
    Operating System Version: 6.1.7600.0

    APPLICATION INFORMATION:
    Application Name: Support Space Call Tracker
    Common Application Data Path: C:\ProgramData\Support Space Call Tracker\Support Space Call Tracker\2011.0.0.26
    Executable Path: C:\Users\Paddy\Desktop\Visual Basic\SupportSpace\SupportSpaceCallTracker\SupportSpaceCallTracker\bin\x86\Debug\SupportSpaceCallTra cker.EXE
    Local User Application Data Path: C:\Users\Paddy\AppData\Local\Support Space Call Tracker\Support Space Call Tracker\2011.0.0.26
    Startup Path: C:\Users\Paddy\Desktop\Visual Basic\SupportSpace\SupportSpaceCallTracker\SupportSpaceCallTracker\bin\x86\Debug
    User Application Data Path: C:\Users\Paddy\AppData\Roaming\Support Space Call Tracker\Support Space Call Tracker\2011.0.0.26
    Thanks for any input.

  2. #2
    Lively Member
    Join Date
    Jan 2011
    Posts
    127

    Re: vbcrlf and vbnewline problem

    Try Chr(13)?
    EXPERIENCED VB6 CODER
    IF YOU SEE ANY FAILURE IN MY CODING, PLEASE LET ME KNOW AS I'VE ONLY JUST STARTED LEARNING VB.NET AND I WILL APPRECIATE ANY HINTS AND TIPS YOU HAVE TO OFFER!

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: vbcrlf and vbnewline problem

    Quote Originally Posted by FredFrothen View Post
    Try Chr(13)?
    Yes, I tried that too and it did the same thing.

  4. #4
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: vbcrlf and vbnewline problem

    Mabey
    Code:
    Environment.NewLine

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: vbcrlf and vbnewline problem

    Quote Originally Posted by BlindSniper View Post
    Mabey
    Code:
    Environment.NewLine
    I did try that also and it didn't change anything.

  6. #6
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: vbcrlf and vbnewline problem

    Sounds like you are doing HTML body for your email message which means </br> will be your line break

    So something like this would fix your line break issue. The following can not be used by copy/paste as it has variables that you do not have.

    Code:
       Sub SendMessage()
            Try
                Using TheMessage As New System.Net.Mail.MailMessage()
                    TheMessage.From = New System.Net.Mail.MailAddress(FromAddress)
                    TheMessage.To.Add(New System.Net.Mail.MailAddress(SendToAddress))
    
                    TheMessage.Subject = ApplicationName
    
                    TheMessage.Body = String.Format( _
                        "This is an automated email, please do not respond<br><br>An " & _
                        "exception ocurred in <br><span style=""font-weight: bold; padding-left:20px;" & _
                        "padding-right:5px"">Application name</span>{0}<br>" & _
                        "<span style=""font-weight: bold; padding-left: 5px;padding-right:5px"">" & _
                        "Application Version</span>{1}<br><span style=""font-weight: bold; " & _
                        "padding-left: 70px;padding-right:5px"">Exception</span>{2}", _
                        ApplicationName, ApplicationVersion, ErrorMessage)
                    TheMessage.IsBodyHtml = True
                    Dim MailClient As New System.Net.Mail.SmtpClient(SmtpClient)
                    MailClient.UseDefaultCredentials = True
                    MailClient.Send(TheMessage)
                End Using
            Catch ex As Exception
                'MsgBox(ex.Message)
            End Try
        End Sub
    Last edited by kareninstructor; Jan 23rd, 2011 at 07:50 AM.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: vbcrlf and vbnewline problem

    Yep, that fixed it. Thanks! I checked out my code and I didn't put in .IsBodyHtml but i have now and I put it as html. Everything is formatted correctly now.
    Quote Originally Posted by kevininstructor View Post
    Sounds like you are doing HTML body for your email message which means </br> will be your line break

    So something like this would fix your line break issue. The following can not be used by copy/paste as it has variables that you do not have.

    Code:
       Sub SendMessage()
            Try
                Using TheMessage As New System.Net.Mail.MailMessage()
                    TheMessage.From = New System.Net.Mail.MailAddress(FromAddress)
                    TheMessage.To.Add(New System.Net.Mail.MailAddress(SendToAddress))
    
                    TheMessage.Subject = ApplicationName
    
                    TheMessage.Body = String.Format( _
                        "This is an automated email, please do not respond<br><br>An " & _
                        "exception ocurred in <br><span style=""font-weight: bold; padding-left:20px;" & _
                        "padding-right:5px"">Application name</span>{0}<br>" & _
                        "<span style=""font-weight: bold; padding-left: 5px;padding-right:5px"">" & _
                        "Application Version</span>{1}<br><span style=""font-weight: bold; " & _
                        "padding-left: 70px;padding-right:5px"">Exception</span>{2}", _
                        ApplicationName, ApplicationVersion, ErrorMessage)
                    TheMessage.IsBodyHtml = True
                    Dim MailClient As New System.Net.Mail.SmtpClient(SmtpClient)
                    MailClient.UseDefaultCredentials = True
                    MailClient.Send(TheMessage)
                End Using
            Catch ex As Exception
                'MsgBox(ex.Message)
            End Try
        End Sub

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [RESOLVED] vbcrlf and vbnewline problem

    I have gotten it to work. I even color coded the severity within the e-mail body. One thing that is baffling is that I have set the message table to 100&#37; (line 34) and the form itself can have a maximum of 8,000 characters. The e-mail shows the message (txtMessage) in one line and it's not all visible without having to scroll to the right. Any suggestions? Do you think I might have to WordWrap it or something?

    Code is below:
    vb Code:
    1. <CLSCompliant(True)> Private Sub cmdSend_Click(ByVal sender As System.Object, _
    2.                                                    ByVal e As System.EventArgs) Handles cmdSend.Click
    3.  
    4.         Try
    5.             'Send the e-mail.
    6.             Dim ToEmailAddress As New MailAddress("[email protected]", "Your Name")
    7.             Dim FromEmailAddress As New MailAddress("" & txtEmailAddress.Text.Trim.ToString & "", "" & ProductName & " User")
    8.             Dim sMessageSubject As String = "[" & cboSeverity.Text.Trim & " Severity] " & ProductName & " User Message."
    9.             Dim sMessage As String = txtMessage.Text.Trim
    10.             Dim sMessageBody As String
    11.  
    12.             Dim sColorCodeSeverity As String = Nothing
    13.  
    14.             Select Case cboSeverity.SelectedItem.ToString
    15.                 Case Is = "Low" '#00CC00 (Green)
    16.                     sColorCodeSeverity = "<font color=#00CC00>Low</font>"
    17.                 Case Is = "Medium" '#0099CC (Blue)
    18.                     sColorCodeSeverity = "<font color=#0099CC>Medium</font>"
    19.                 Case Is = "High" '#FF3300 (Red)
    20.                     sColorCodeSeverity = "<b><font color=#FF3300>High</font></b>"
    21.                 Case Is = "Urgent" '#FF6699 (Pink)
    22.                     sColorCodeSeverity = "<b><font color=#FF6699>Urgent</font></b>"
    23.                 Case Is = "Critical" '#993366 (Purple)
    24.                     sColorCodeSeverity = "<b><font color=#993366>Critical</font></b>"
    25.             End Select
    26.  
    27.             sMessageBody = "<font color=red><b>REMINDER:</b> If the end user has requested a reply e-mail, they were promised an e-mail within 48 hours.</font><br><br>" & _
    28.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=100% cellpadding=3 cellspacing=3>" & _
    29.                            "<tr>" & _
    30.                            "<td width=15%>Client Name:</td><td>" & txtName.Text.Trim & "</td></tr><tr>" & _
    31.                            "<td width=15%>Contact Reason:</td><td>" & cboContactReason.SelectedItem.ToString & "</td>" & _
    32.                            "</tr><tr>" & _
    33.                            "<td width=15%>Requires a reply:</td><td>" & cboReplyBack.SelectedItem.ToString & "</td></tr><tr>" & _
    34.                            "<td width=15%>Severity:</td><td>" & sColorCodeSeverity & "</td></tr></table><br>" & _
    35.                            "<b>E-MAIL MESSAGE:</b>" & _
    36.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=100% cellpadding=3 cellspacing=3>" & _
    37.                            "<tr><td>" & sMessage & "</td></tr></table><br>" & _
    38.                            "<b>MACHINE INFORMATION:</b>" & _
    39.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=42% cellpadding=3 cellspacing=3>" & _
    40.                            "<tr>" & _
    41.                            "<td>Computer Name:</td><td>" & My.Computer.Name & "</td>" & _
    42.                            "</tr><tr>" & _
    43.                            "<td>Available Physical Memory:</td><td>" & My.Computer.Info.AvailablePhysicalMemory & "</td>" & _
    44.                            "<tr>" & _
    45.                            "<td>Available Virtual Memory:</td><td>" & My.Computer.Info.AvailableVirtualMemory & "</td>" & _
    46.                            "</tr><tr>" & _
    47.                            "<td>Total Physical Memory:</td><td>" & My.Computer.Info.TotalPhysicalMemory & "</td>" & _
    48.                            "</tr><tr>" & _
    49.                            "<td>Total Virtual Memory:</td><td>" & My.Computer.Info.TotalVirtualMemory & "</td>" & _
    50.                            "</tr><tr>" & _
    51.                            "<td>Operating System Full Name:</td><td>" & My.Computer.Info.OSFullName & "</td>" & _
    52.                            "</tr><tr>" & _
    53.                            "<td>Operating System Platform:</td><td>" & My.Computer.Info.OSPlatform & "</td>" & _
    54.                            "</tr><tr>" & _
    55.                            "<td>Operating System Version:</td><td>" & My.Computer.Info.OSVersion & "</td>" & _
    56.                            "</tr>" & _
    57.                            "</table><br>" & _
    58.                            "<b>APPLICATION INFORMATION:</b>" & "<br>" & _
    59.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=100% cellpadding=3 cellspacing=3>" & _
    60.                            "<tr>" & _
    61.                            "<td>Application Name:</td><td>" & My.Application.Info.ProductName & "</td>" & _
    62.                            "</tr><tr>" & _
    63.                            "<td>Common Application Data Path:</td><td>" & CommonAppDataPath & "</td>" & _
    64.                            "</tr><tr>" & _
    65.                            "<td>Executable Path:</td><td>" & ExecutablePath & "</td>" & _
    66.                            "</tr><tr>" & _
    67.                            "<td>Local User Application Data Path:</td><td>" & LocalUserAppDataPath & "</td>" & _
    68.                            "</tr><tr>" & _
    69.                            "<td>Startup Path:</td><td>" & StartupPath & "</td>" & _
    70.                            "</tr><tr>" & _
    71.                            "<td>User Application Data Path:</td><td>" & UserAppDataPath & "</td></tr></table>"
    72.  
    73.             Dim MailPriority As New Net.Mail.MailPriority
    74.  
    75.             Select Case cboPriority.Text
    76.                 Case "Low"
    77.                     MailPriority = Net.Mail.MailPriority.Low
    78.                 Case "Normal"
    79.                     MailPriority = Net.Mail.MailPriority.Normal
    80.                 Case "High"
    81.                     MailPriority = Net.Mail.MailPriority.High
    82.             End Select
    83.  
    84.             clsSendMail.SendMail(sMessageBody, _
    85.                                  sMessageSubject, _
    86.                                  Net.Mail.DeliveryNotificationOptions.OnFailure, _
    87.                                  MailPriority, _
    88.                                  ToEmailAddress, _
    89.                                  FromEmailAddress, _
    90.                                  Nothing, _
    91.                                  Nothing, _
    92.                                  Nothing)
    93.         Catch ex As InvalidCastException
    94.             MessageBox.Show(ex.Message, _
    95.                             "Invalid Cast Exception.", _
    96.                             MessageBoxButtons.OK, _
    97.                             MessageBoxIcon.Error, _
    98.                             MessageBoxDefaultButton.Button1, _
    99.                             MessageBoxOptions.DefaultDesktopOnly, _
    100.                             False)
    101.         Catch ex As FormatException
    102.             MessageBox.Show(ex.Message, _
    103.                 "Format Exception.", _
    104.                 MessageBoxButtons.OK, _
    105.                 MessageBoxIcon.Error, _
    106.                 MessageBoxDefaultButton.Button1, _
    107.                 MessageBoxOptions.DefaultDesktopOnly, _
    108.                 False)
    109.         Finally
    110.             If cboReplyBack.Text = "Yes" Then
    111.                 MessageBox.Show("Your e-mail message was successfully sent, " & txtName.Text.Trim & "!" & vbNewLine & _
    112.                                 "You will hear from us via e-mail within 48 hours.", _
    113.                                 "E-mail Successfully Sent.", _
    114.                                 MessageBoxButtons.OK, _
    115.                                 MessageBoxIcon.Information, _
    116.                                 MessageBoxDefaultButton.Button1, _
    117.                                 MessageBoxOptions.DefaultDesktopOnly, _
    118.                                 False)
    119.             Else 'No.
    120.                 MessageBox.Show("Your e-mail message was successfully sent, " & txtName.Text.Trim & "!", _
    121.                                 "E-mail Successfully Sent.", _
    122.                                 MessageBoxButtons.OK, _
    123.                                 MessageBoxIcon.Information, _
    124.                                 MessageBoxDefaultButton.Button1, _
    125.                                 MessageBoxOptions.DefaultDesktopOnly, _
    126.                                 False)
    127.             End If
    128.         End Try
    129.     End Sub

  9. #9
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: [RESOLVED] vbcrlf and vbnewline problem

    Quote Originally Posted by BrailleSchool View Post
    I have gotten it to work. I even color coded the severity within the e-mail body. One thing that is baffling is that I have set the message table to 100% (line 34) and the form itself can have a maximum of 8,000 characters. The e-mail shows the message (txtMessage) in one line and it's not all visible without having to scroll to the right. Any suggestions? Do you think I might have to WordWrap it or something?

    Code is below:
    vb Code:
    1. <CLSCompliant(True)> Private Sub cmdSend_Click(ByVal sender As System.Object, _
    2.                                                    ByVal e As System.EventArgs) Handles cmdSend.Click
    3.  
    4.         Try
    5.             'Send the e-mail.
    6.             Dim ToEmailAddress As New MailAddress("[email protected]", "Your Name")
    7.             Dim FromEmailAddress As New MailAddress("" & txtEmailAddress.Text.Trim.ToString & "", "" & ProductName & " User")
    8.             Dim sMessageSubject As String = "[" & cboSeverity.Text.Trim & " Severity] " & ProductName & " User Message."
    9.             Dim sMessage As String = txtMessage.Text.Trim
    10.             Dim sMessageBody As String
    11.  
    12.             Dim sColorCodeSeverity As String = Nothing
    13.  
    14.             Select Case cboSeverity.SelectedItem.ToString
    15.                 Case Is = "Low" '#00CC00 (Green)
    16.                     sColorCodeSeverity = "<font color=#00CC00>Low</font>"
    17.                 Case Is = "Medium" '#0099CC (Blue)
    18.                     sColorCodeSeverity = "<font color=#0099CC>Medium</font>"
    19.                 Case Is = "High" '#FF3300 (Red)
    20.                     sColorCodeSeverity = "<b><font color=#FF3300>High</font></b>"
    21.                 Case Is = "Urgent" '#FF6699 (Pink)
    22.                     sColorCodeSeverity = "<b><font color=#FF6699>Urgent</font></b>"
    23.                 Case Is = "Critical" '#993366 (Purple)
    24.                     sColorCodeSeverity = "<b><font color=#993366>Critical</font></b>"
    25.             End Select
    26.  
    27.             sMessageBody = "<font color=red><b>REMINDER:</b> If the end user has requested a reply e-mail, they were promised an e-mail within 48 hours.</font><br><br>" & _
    28.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=100% cellpadding=3 cellspacing=3>" & _
    29.                            "<tr>" & _
    30.                            "<td width=15%>Client Name:</td><td>" & txtName.Text.Trim & "</td></tr><tr>" & _
    31.                            "<td width=15%>Contact Reason:</td><td>" & cboContactReason.SelectedItem.ToString & "</td>" & _
    32.                            "</tr><tr>" & _
    33.                            "<td width=15%>Requires a reply:</td><td>" & cboReplyBack.SelectedItem.ToString & "</td></tr><tr>" & _
    34.                            "<td width=15%>Severity:</td><td>" & sColorCodeSeverity & "</td></tr></table><br>" & _
    35.                            "<b>E-MAIL MESSAGE:</b>" & _
    36.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=100% cellpadding=3 cellspacing=3>" & _
    37.                            "<tr><td>" & sMessage & "</td></tr></table><br>" & _
    38.                            "<b>MACHINE INFORMATION:</b>" & _
    39.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=42% cellpadding=3 cellspacing=3>" & _
    40.                            "<tr>" & _
    41.                            "<td>Computer Name:</td><td>" & My.Computer.Name & "</td>" & _
    42.                            "</tr><tr>" & _
    43.                            "<td>Available Physical Memory:</td><td>" & My.Computer.Info.AvailablePhysicalMemory & "</td>" & _
    44.                            "<tr>" & _
    45.                            "<td>Available Virtual Memory:</td><td>" & My.Computer.Info.AvailableVirtualMemory & "</td>" & _
    46.                            "</tr><tr>" & _
    47.                            "<td>Total Physical Memory:</td><td>" & My.Computer.Info.TotalPhysicalMemory & "</td>" & _
    48.                            "</tr><tr>" & _
    49.                            "<td>Total Virtual Memory:</td><td>" & My.Computer.Info.TotalVirtualMemory & "</td>" & _
    50.                            "</tr><tr>" & _
    51.                            "<td>Operating System Full Name:</td><td>" & My.Computer.Info.OSFullName & "</td>" & _
    52.                            "</tr><tr>" & _
    53.                            "<td>Operating System Platform:</td><td>" & My.Computer.Info.OSPlatform & "</td>" & _
    54.                            "</tr><tr>" & _
    55.                            "<td>Operating System Version:</td><td>" & My.Computer.Info.OSVersion & "</td>" & _
    56.                            "</tr>" & _
    57.                            "</table><br>" & _
    58.                            "<b>APPLICATION INFORMATION:</b>" & "<br>" & _
    59.                            "<table border=0 bordercolor=#FFFFFF style=background-color:#FFFFFF width=100% cellpadding=3 cellspacing=3>" & _
    60.                            "<tr>" & _
    61.                            "<td>Application Name:</td><td>" & My.Application.Info.ProductName & "</td>" & _
    62.                            "</tr><tr>" & _
    63.                            "<td>Common Application Data Path:</td><td>" & CommonAppDataPath & "</td>" & _
    64.                            "</tr><tr>" & _
    65.                            "<td>Executable Path:</td><td>" & ExecutablePath & "</td>" & _
    66.                            "</tr><tr>" & _
    67.                            "<td>Local User Application Data Path:</td><td>" & LocalUserAppDataPath & "</td>" & _
    68.                            "</tr><tr>" & _
    69.                            "<td>Startup Path:</td><td>" & StartupPath & "</td>" & _
    70.                            "</tr><tr>" & _
    71.                            "<td>User Application Data Path:</td><td>" & UserAppDataPath & "</td></tr></table>"
    72.  
    73.             Dim MailPriority As New Net.Mail.MailPriority
    74.  
    75.             Select Case cboPriority.Text
    76.                 Case "Low"
    77.                     MailPriority = Net.Mail.MailPriority.Low
    78.                 Case "Normal"
    79.                     MailPriority = Net.Mail.MailPriority.Normal
    80.                 Case "High"
    81.                     MailPriority = Net.Mail.MailPriority.High
    82.             End Select
    83.  
    84.             clsSendMail.SendMail(sMessageBody, _
    85.                                  sMessageSubject, _
    86.                                  Net.Mail.DeliveryNotificationOptions.OnFailure, _
    87.                                  MailPriority, _
    88.                                  ToEmailAddress, _
    89.                                  FromEmailAddress, _
    90.                                  Nothing, _
    91.                                  Nothing, _
    92.                                  Nothing)
    93.         Catch ex As InvalidCastException
    94.             MessageBox.Show(ex.Message, _
    95.                             "Invalid Cast Exception.", _
    96.                             MessageBoxButtons.OK, _
    97.                             MessageBoxIcon.Error, _
    98.                             MessageBoxDefaultButton.Button1, _
    99.                             MessageBoxOptions.DefaultDesktopOnly, _
    100.                             False)
    101.         Catch ex As FormatException
    102.             MessageBox.Show(ex.Message, _
    103.                 "Format Exception.", _
    104.                 MessageBoxButtons.OK, _
    105.                 MessageBoxIcon.Error, _
    106.                 MessageBoxDefaultButton.Button1, _
    107.                 MessageBoxOptions.DefaultDesktopOnly, _
    108.                 False)
    109.         Finally
    110.             If cboReplyBack.Text = "Yes" Then
    111.                 MessageBox.Show("Your e-mail message was successfully sent, " & txtName.Text.Trim & "!" & vbNewLine & _
    112.                                 "You will hear from us via e-mail within 48 hours.", _
    113.                                 "E-mail Successfully Sent.", _
    114.                                 MessageBoxButtons.OK, _
    115.                                 MessageBoxIcon.Information, _
    116.                                 MessageBoxDefaultButton.Button1, _
    117.                                 MessageBoxOptions.DefaultDesktopOnly, _
    118.                                 False)
    119.             Else 'No.
    120.                 MessageBox.Show("Your e-mail message was successfully sent, " & txtName.Text.Trim & "!", _
    121.                                 "E-mail Successfully Sent.", _
    122.                                 MessageBoxButtons.OK, _
    123.                                 MessageBoxIcon.Information, _
    124.                                 MessageBoxDefaultButton.Button1, _
    125.                                 MessageBoxOptions.DefaultDesktopOnly, _
    126.                                 False)
    127.             End If
    128.         End Try
    129.     End Sub
    When coding in web projects I've had to use the following style for the Body tag to get a table to recognize the 100% width. Not sure if email providers recognize the body tag.

    Code:
    body {margin:0;padding:0;}

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [RESOLVED] vbcrlf and vbnewline problem

    Quote Originally Posted by kevininstructor View Post
    When coding in web projects I've had to use the following style for the Body tag to get a table to recognize the 100% width. Not sure if email providers recognize the body tag.

    Code:
    body {margin:0;padding:0;}
    Thanks, got it working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width