none
Put text as string strictly

    Question

  • Hi simple question: How to make below text whole as string?

    Recorded by" & vbLf & "FO Staff

    Friday, April 7, 2017 9:03 AM

Answers

  • Hello,

    Try this, which literally is the method to do the operation. 

    Dim value As String = "Recorded by""" & vbLf & """FO Staff"


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, April 7, 2017 9:11 AM
    Moderator
  • So the string looks slightly different in your current reply. To replicate this without me using Excel I place the string into My.Settings.

    Dim cellValue As String = My.Settings.ValueFromExcel.Replace("& vbLf &", Environment.NewLine)

    Or

    Dim cellValue As String = My.Settings.ValueFromExcel.Replace("& vbLf &", vbLf)


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, April 7, 2017 9:47 AM
    Moderator

All replies

  • Hello,

    Try this, which literally is the method to do the operation. 

    Dim value As String = "Recorded by""" & vbLf & """FO Staff"


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, April 7, 2017 9:11 AM
    Moderator
  • Can you elaborate more.

    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

    Friday, April 7, 2017 9:12 AM
  • Something wrong, let me explain, i am taking columns names from excel. In our example i received that value:

    "Recorded by" & vbLf & "FO Staff "

    So i have to prapre same string from my program to validate, you example giving me this below so not exactly the same:

    "Recorded by""" & vbLf & """FO Staff"


    • Edited by JimmyJimm Friday, April 7, 2017 9:22 AM
    Friday, April 7, 2017 9:21 AM
  • you need to add escape character like 

    string st = "abc" + "\"1\"";
    * This is a C# example you need to use `&` in place of '+' and ofcouse no ';' at the end.


    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora


    • Edited by RohitArora Friday, April 7, 2017 9:31 AM
    Friday, April 7, 2017 9:26 AM
  • Still got problems can you show how this has to be done on my example?
    Friday, April 7, 2017 9:34 AM
  • you need to add escape character like 

    string st = "abc" + "\"1\"";
    * This is a C# example you need to use `&` in place of '+' and ofcouse no ';' at the end.


    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora


    VB.NET please, remember this is a forum for VB. This is not the first time you have done this.

    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, April 7, 2017 9:39 AM
    Moderator
  • So the string looks slightly different in your current reply. To replicate this without me using Excel I place the string into My.Settings.

    Dim cellValue As String = My.Settings.ValueFromExcel.Replace("& vbLf &", Environment.NewLine)

    Or

    Dim cellValue As String = My.Settings.ValueFromExcel.Replace("& vbLf &", vbLf)


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, April 7, 2017 9:47 AM
    Moderator
  • Watch the parentheses in this code


    Success
    Cor

    Friday, April 7, 2017 9:49 AM
  • Something wrong, let me explain, i am taking columns names from excel. In our example i received that value:

    "Recorded by" & vbLf & "FO Staff "

    So i have to prapre same string from my program to validate...

    That is the answer to your question...

    Dim validationString As String = "Recorded by" & vbLf & "FO Staff "

    or in VS2015+

    Dim validationString As String = $"Recorded by{vbLf}FO Staff "


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, April 7, 2017 2:10 PM
    Moderator
  • Hi JimmyJimm,

    Please try this:

    TextBox1.Text = "Recorded by "" & vbLf & ""FO Staff"

    Hope it is helpful to you.

    Best Regards,

    Cherry Bu


    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.

    Tuesday, April 11, 2017 5:38 AM
    Moderator
  • Hi JimmyJimm,

    Have you solved your issue now, If yes, please remember to close your thread by marking helpful post as answer, it is very beneficial to the other communities who face the same issue.

    Best regards,

    Cherry Bu


    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.

    Thursday, April 20, 2017 6:59 AM
    Moderator