Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

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.

License

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

Share

About the Author

shubha_vasisht
Web Developer
India India
No Biography provided

Comments and Discussions

 
GeneralRidiculous explanation of a simple problem. :laugh: My vote... PinmemberJecka23-Nov-10 22:03 
GeneralReason for my vote of 1 Your dimensions are completely inacc... PinmemberMarqW19-Nov-10 4:10 
GeneralReason for my vote of 5 :) PinmemberJFergulbops8-Nov-10 22:46 
GeneralReason for my vote of 1 I agree, it is quite basic thing. Pinmvpprerakpatel24-Oct-10 18:14 
GeneralThanx PinmemberMohunnud Basic Uglu21-Oct-10 1:00 
GeneralReason for my vote of 1 It could be unknown to only person w... PinmemberHiren Solanki21-Oct-10 0:27 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 20 Oct 2010
Article Copyright 2010 by shubha_vasisht
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid