2

I need to store a multiline string inside a variable:

dim str as string = "
    some words
    some words
    some
    words
"

How?

4
  • Add Environment.NewLine where you want the line break Commented Jun 8, 2013 at 17:12
  • 1
    @Steve thanks 'cause that's a solution but really I want to avoid the usage of "newlines" because I have texts of a large number of lines, I cannot set a multiline string in vbnet as C# multiline strings? Commented Jun 8, 2013 at 17:16
  • You don't want to use Environment.NewLine but want newlines in the string? Commented Jun 8, 2013 at 17:20
  • you might consider using external text file if your text is extremely large. Commented Jun 8, 2013 at 18:17

2 Answers 2

8

No need to use the classes to insert new lines, you can do it like this:

Dim Logo As String= <a><![CDATA[
___  ___        _  _    _  _  _              
|  \/  |       | || |  (_)| |(_)             
| .  . | _   _ | || |_  _ | | _  _ __    ___ 
| |\/| || | | || || __|| || || || '_ \  / _ \
| |  | || |_| || || |_ | || || || | | ||  __/
\_|  |_/ \__,_||_| \__||_||_||_||_| |_| \___|


 _____  _          _                         
/  ___|| |        (_)                        
\ `--. | |_  _ __  _  _ __    __ _           
 `--. \| __|| '__|| || '_ \  / _` |          
/\__/ /| |_ | |   | || | | || (_| |          
\____/  \__||_|   |_||_| |_| \__, |          
                              __/ |          
                             |___/           
]]></a>.Value

Console.WriteLine(Logo)
Sign up to request clarification or add additional context in comments.

Comments

0

Make it like this ..

dim str as string = "some words" & vbCrlf & "some words" & vbCrlf & "some" & vbCrlf & "words"

OR try it with vbLf

Comments