borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (How to extract the \"target\" property of a shortcut)Next Topic (what is \"Invalid use of Null\"?) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Convert Text String to Array
Poster Message
balanj
Level: Trainee

Registered: 16-09-2006
Posts: 1

Ads by Lake Quincy Media
icon Convert Text String to Array

I have a textbox which displays a series of numbers.

I'm hoping to convert the numbers in the textbox into a Number Array... which I need to place into a Line Chart (as a series of Data Points)

For example, my textbox looks like:

txtNumbers.Text = 10, 20, 30, 40, 50

Now, I need to take the String, and convert to a Number Array... for my chart data array:

Dim data()
data = Array(10, 20, 30, 40, 50)

I'm still learning VB, so any help will be GREATLY appreciated!!!

Thanks!!!

Ads by Lake Quincy Media
16-09-2006 at 02:43 AM
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 933
icon Re: Convert Text String to Array

Hello. Have a look at the Split() function: it accepts a delimited string and fills an array with all the string pieces among the specified delimiter.

Hope it helps.

____________________________
Real Programmer can count up to 1024 on his fingers

16-09-2006 at 07:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
humberto
Level: VB Lord

Registered: 13-01-2005
Posts: 256
icon Re: Convert Text String to Array



Dim sNumber() As String, i As Integer
sNumber() = Split(txtNumbers.Text, ",")
For i = 0 To UBound(sNumber)
   Debug.Print sNumber(i)
Next

02-10-2006 at 12:09 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Convert Text String to Array
Previous Topic (How to extract the \"target\" property of a shortcut)Next Topic (what is \"Invalid use of Null\"?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder