vb.net char() to String


How do you cast a char array to a String?  Here's what I do:

Dim string2 As String
Dim string1 As String = "hello"
Dim charArray() As Char = string1.ToCharArray()
string2 = Cstr(charArray)

I am getting "A first chance exception of type 'System.InvalidCastException' occurred..." error message.

I tried: string2 = New String(charArray)
Same deal.

Please help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
You can do:

    string2 = Convert.ToString(charArray)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Another option

string2 = charArray.ToString
sdc248Author Commented:
charArray.ToString gives me "System.Char()"
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.