Question

I was trying someting like:

Dim experiment As String = "Predefined experiment string.."

but sadly its not working so is there any way to predefine a string with a similar way in vb6?

Was it helpful?

Solution

For a constant string:

const experiment As String = "Predefined experiment string.."

At the top of a module/class/form with an access modifier for the corresponding scope, or in a routine as a local.

For strings with variable content you cannot declare and assign on the same line, you can however:

Dim experiment As String: experiment = "Predefined experiment string.."

OTHER TIPS

You are doing two things in a single statement: declaring a variable and initializing it.

In VB6 you have to do this in separate steps:

Dim experiment As String 
experiment = "Predefined experiment string.."
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top