Pregunta

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?

¿Fue útil?

Solución

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.."

Otros consejos

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.."
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top