how to use reserved words on a html (text) variable RRS feed

  • Question

  • I need to use "New" and "To",

    Is there a way to do that?

    is the part of the

    Imports System.Net.Mail

    msg.Body = the_body
    msg.IsBodyHtml = True

    the_body = "<html><body>
    <p>" & the_salutation & ",</p>
    <p>NCR : <b>" & the_ncr & "</b></p>
    <p> </p>  
    <p><b>Please Note : </b></p>
    <p>"We have a newly created NCR that needs to be assigned to a Eng"</p>
    <>Regards,</p><p>QCI Office</p></body></html>"

    Thank you all


    • Edited by Bre-x Wednesday, May 20, 2020 5:02 PM
    Wednesday, May 20, 2020 5:00 PM

All replies

  • As per

    Dim [new] As String = ""
    Dim [To] As String = ""


    Public Class Mail
        Property [To]() As String
    End Class


    Dim mail As New Mail With {.To = ""}

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Wednesday, May 20, 2020 5:20 PM
  • Thank you Karen,

    Outside my comfort zone. I never took any formal programming training

    I will try to apply it to my code


    • Edited by Bre-x Wednesday, May 20, 2020 6:19 PM
    Wednesday, May 20, 2020 6:18 PM
  • Hi,

    If the variable you need has the same name as the reserved word in VB.NET, you must put the reserved word in [], and then use the reserved word as the variable name.

    For example:

            Dim [New] As Integer = 1 'correct way
            Dim To As Integer = 2 ' error: Keyword is not valid as an identifier

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 25, 2020 6:23 AM