Is there any way to predefine a string in vb6?
-
29-04-2021 - |
質問
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?
解決
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.."
他のヒント
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.."
所属していません StackOverflow