Dan_Howles
(Dan Howles)
October 22, 2021, 9:03pm
#1
Hey all,
I am having some trouble initialize an argument that is a Dictionary that contains a String and a StringArray.
I assumed New Dictionary (String,String ) would of worked but it’s not.
Just wondering if any one could help shed some light on this.
Thanks for your help
postwick
(Paul)
October 22, 2021, 9:08pm
#2
The proper syntax is
New Dictionary(of string, string )
You left out the of.
2 Likes
Dan_Howles
(Dan Howles)
October 22, 2021, 9:11pm
#3
Thanks for the quick reply!
However i forgot it i n the post, but not in my code. That is still not working.
I’m sure i’m missing something very simple like that.
c.ciprian
(Ciprian Constantinescu)
October 22, 2021, 9:13pm
#4
New Dictionary(Of String, String())
Dirty hack/trick: if you don’t know the datatype, just dump in whatever and read carefully the error
1 Like
Dan_Howles
(Dan Howles)
October 22, 2021, 9:16pm
#5
Wow, that’s amazing!
That seems to have worked perfectly!
I’ve been here for 20 mins trying to fix that and you did it in less than 6
If it’s not too much trouble can you explain what the difference was between the two post? Just I can learn from this.
My original code contained an “of”, i just missed when i posted (and wasn’t aware of the lack of editing) so i don’t believe it was just that.
c.ciprian
(Ciprian Constantinescu)
October 22, 2021, 9:22pm
#6
In vb.net you declare an array of strings like this, not with square brackets
Dim myArray() As String
In the declaration you needed Of Type, Type , and the type array of strings is String()
Also take a look at the snapshot above. It will be easier if you read the errors.
postwick
(Paul)
October 22, 2021, 9:58pm
#7
That’s weird because when you choose Array of String through the variable definition screens, where you select from the popup, it displays it as String[]
not String ().
system
(system)
closed
October 25, 2021, 9:58pm
#8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.