GameBuilder GameBuilder - 6 months ago 9
Vb.net Question

How do I use a variable instead of a literal string?

I have a function:

Private Function generateXMLSchema(ZRouteName) As String

Dim generatedXmlSchema As String ="<Name>tEST 250504</Name>"


Where the value of the "Name" element is a literal string.

I want to use the variable
ZRouteName
instead of the literal string:

"<Name>"ZRouteName"</Name>"


I am getting the error: "Syntax Error".

Please help to rectify this.

Answer

You need to use the ampersand (&) to concatenate your variable to the string like this

"<Name>" & ZRouteName & "</Name>"