Visual Basic: Multiline Literals, Its the Strings, Really...
Author: jason
Date: 2019-05-03 10:39:05
Category: Technical

New in VB14 is strings that can go on more than one line!! Wowser...

So, I did a couple things in my Visual Studio 2017 to try getting this to work.

1. In the Project properties I set my framework to 4.5 or higher
2. In the NuGet Package Manager I added the Dot Net Compiler
3. In the Web Config (or App Config) I went looking for the Dot Net Compiler line for VB in the compiler keys and changed the /langversion:default to /langversion:14

Strange that it took VB this long to get multiline strings...


https://stackoverflow.com/questions/706382/multiline-strings-in-vb-net

https://visualstudiomagazine.com/blogs/tool-tracker/2015/05/vb-14-string-interpolation-multiline-literals.aspx

Unfortunately, you can't do that if you are using VBScript in Classic ASP. But, if you want multi-line strings (like for SQL queries) as they are easy to edit, and you can handle putting them in Text files, you can read the contents of a Text file into the string like this

Code

Dim query
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("query.txt"), 1)
query = TRIM(f.ReadAll)
f.Close
response.write(query)







jason @ jasonthomasfrance.com - www.masterstationlog.com - copyright 2009