Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB

ok lets say in my string collection i got

String Collection
"hi, name1a, name2a"
"Hello, name1b, name2b"

And lets say I want 0 in the array and that is

"hi, name1a, name2a"

Ive selected

not it want to het "hi"

so then I split it do then it will look like this

"hi"
"name1a"
"name2a"

so then I want to select "hi" so i select the index 0 then it comes up with

"hi"

so then i get the string I want
this is my code that i got

VB
Dim thesplit As String = Split(My.Settings.ModelScores(0), ",")


I want to do that medthod with that code, but i get this error for this line of code

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

can some one please slove this? I don't understand why the string in index 1 cannot be put into a string and then split.
Posted

Split function returns an array of String.

Declare your variable like this:

VB
Dim thesplit() As String 



For more information please follow below links:

Split Function

VB.NET Split
 
Share this answer
 
v2
Hello, Buddy

You take variable as :

Dim thesplit As String = Split(My.Settings.ModelScores(0), ",")


Here you do change only its

Dim thesplit As String() = Split(My.Settings.ModelScores(0), ",")


After that you can get all string in array on index wise.

For more detail you can study on this link
http://vb.net-informations.com/string/vb.net_String_Split.htm[^]


Happy Coading Buddy
:)
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900