Answered by:
Put text as string strictly

Question
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
- Proposed as answer by John Anthony Oliver Wednesday, April 12, 2017 10:54 PM
- Marked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:49 PM
- Unmarked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:49 PM
- Marked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:50 PM
-
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
- Marked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:49 PM
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
- Proposed as answer by John Anthony Oliver Wednesday, April 12, 2017 10:54 PM
- Marked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:49 PM
- Unmarked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:49 PM
- Marked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:50 PM
-
-
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
-
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
-
-
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
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
-
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
- Marked as answer by Reed KimbleMVP, Moderator Sunday, April 30, 2017 12:49 PM
-
-
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"
-
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. -
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.