Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

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.."
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top