Hi everyone, I want to know if the VB6 String is nullable?. Please consider this
Dim TestStr As String
without assigning a value, what is the value of TestStr it is 'null' or empty ""?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I don't know about VB6, but in VB.NET, which the documentation page you're looking at is about, String is a reference type, so its default value is Nothing (known as null in other languages).
I don't remember, @jonathanlisoan, and I don't have a copy of VB6 available. Visual Basic .NET and VB 6.0 are very different products, My guess is that its default value is an empty string. But you should be able to tell with code something like the following:
Dim s As String
MsgBox(s Is Nothing)
It should either display True, in which case the default value of a string is Nothing, or False, in which case the default value of a string is "" or empty (which is probably most likely). If there's a compiler error, it's most likely because a string is not an object and therefore its value is an empty string.
I'm going to lose this issue, since this repository is for .NET-related issues. But feel free to respond if you need additional guidance.
Most helpful comment
I don't remember, @jonathanlisoan, and I don't have a copy of VB6 available. Visual Basic .NET and VB 6.0 are very different products, My guess is that its default value is an empty string. But you should be able to tell with code something like the following:
It should either display True, in which case the default value of a string is Nothing, or False, in which case the default value of a string is "" or empty (which is probably most likely). If there's a compiler error, it's most likely because a string is not an object and therefore its value is an empty string.
I'm going to lose this issue, since this repository is for .NET-related issues. But feel free to respond if you need additional guidance.