tags:

views:

317

answers:

1

Possible Duplicate:
VB.Net Initialising an array on the fly

This maybe a stupid question, but its got me exasperated. How do I declare a new array inline? Is this possible? I've tried all of the following and they all don't work.

myVar = {"a", "b", "c"}
myVar = Array(3)
myVar = Array("a", "b", "c")
myVar = New Array()
myVar = New Array(3)
myVar = New Array("a", "b", "c")
+1  A: 

Either

Dim strings = New String() {"a", "b", "c"}

or

Dim strings() As String = {"a", "b", "c"}

should work

jitter
Thanks! Wish the editor Error reporting told me that I had to explicitly define {} arrays.
Jenko
Correct answer!Note: In VB10, you may even just write { "a", "b", "c" }
Dario