addrange for hashset

I have a hashset and would like to add it to a combobox.

So this works
Dim strLeaderNameListString() As String
ComboBox1.Items.Clear()
        ComboBox1.Text = Nothing
        Me.ComboBox1.Items.AddRange(strLeaderNameListString)
        ComboBox1.Select()

Anything close to make this work?
Dim strLeaderNameListString As HashSet(Of String)
ComboBox1.Items.Clear()
        ComboBox1.Text = Nothing
        Me.ComboBox1.Items.AddRange(strLeaderNameListString)
        ComboBox1.Select()
chadmanvbAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Fernando SotoConnect With a Mentor RetiredCommented:
Sorry my fault I gave you the wrong line to change. Change that line back and change the following line of code.

 Me.ComboBox1.Items.AddRange(strLeaderNameListString)

To this :

 Me.ComboBox1.Items.AddRange(strLeaderNameListString.ToArray())
0
 
Fernando SotoRetiredCommented:
Getting any errors? If so please post along with the inner exception.
0
 
chadmanvbAuthor Commented:
I get an error telling me:
ComboBox1.Items.AddRange(strPKGNameList)
Error      1      Value of type 'System.Collections.Generic.HashSet(Of String)' cannot be converted to '1-dimensional array of Object'.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Fernando SotoRetiredCommented:
Try changing this line in the code :

 Me.ComboBox1.Items.AddRange(strLeaderNameListString)

To This :

 Me.ComboBox1.Items.AddRange(strLeaderNameListString.ToArray())
0
 
chadmanvbAuthor Commented:
I dont see .ToArray as being an option for

Dim strLeaderNameListString As HashSet(Of String)
0
 
Fernando SotoRetiredCommented:
What version of Visual Studio are you using?
0
 
chadmanvbAuthor Commented:
2010 pro and working with .net 4.0
0
 
chadmanvbAuthor Commented:
Works great!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.