65.9K
CodeProject is changing. Read more.
Home

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

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.60/5 (5 votes)

Oct 20, 2010

CPOL
viewsIcon

48860

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.