P
pmclinn
What is the difference between these declarations:
Dim strMyData() as string
and
Dim strMyData as string()
-Peter
Dim strMyData() as string
and
Dim strMyData as string()
-Peter
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Cor Ligthert said:As Greg said they have equal results,
However
dim str(10) as String goes and
dim str() as String(10) does not go
But 'Dim astr As String(10) {}' will work.

Stephany Young said:Although it's not quite the same, the following can be very useful.
Dim astr() As String
.
.
.
astr = New String(10) {}
Greg Burns said:Don't be so sure. I still think it is just depracted syntax.
Ravichandran J.V. said:Dim strMyData() as string
means that you are initializing an array of strings
Dim strMyData as string()
is simply wrong syntax. The open and close parentheses at the end of the
statement signifies that you are providing reference to the class
through the default constructor of the class but since you are not using
it with the New keyword it is wrong syntax.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.