Click here to Skip to main content
13,050,840 members (63,497 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 20 Oct 2010

Solving "Value of type 'String' cannot be converted to '1-dimensional array of String'."

, 20 Oct 2010
Rate this:
Please Sign up or sign in to vote.
While working with String Arrays, the most common error we come across will be :

"Value of type 'String' cannot be converted to '1-dimensional array of String'."

As in a hurry we forget that we are dealing with arrays.

Usually we do declare an array as

Dim arr as String[] or Dim arr[] as String

But in a hurry, during initialization we try

arr = "6" or
arr = {"6"} or
arr = New String("6")

But still we get the same error.

Initialize the array as below :

arr = New String() {"6"}

and it will solve our problem.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralRidiculous explanation of a simple problem. :laugh: My vote... Pin
Jecka23-Nov-10 22:03
memberJecka23-Nov-10 22:03 
GeneralReason for my vote of 1 Your dimensions are completely inacc... Pin
MarqW19-Nov-10 4:10
memberMarqW19-Nov-10 4:10 
GeneralReason for my vote of 5 :) Pin
JFergulbops8-Nov-10 22:46
memberJFergulbops8-Nov-10 22:46 
GeneralReason for my vote of 1 I agree, it is quite basic thing. Pin
prerakpatel24-Oct-10 18:14
mvpprerakpatel24-Oct-10 18:14 
GeneralThanx Pin
Mohunnud Basic Uglu21-Oct-10 1:00
memberMohunnud Basic Uglu21-Oct-10 1:00 
GeneralReason for my vote of 1 It could be unknown to only person w... Pin
Hiren Solanki21-Oct-10 0:27
memberHiren Solanki21-Oct-10 0:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 20 Oct 2010
Article Copyright 2010 by shubha_vasisht
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid