|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
read textbox into array - vb2005Hello,
Can someone please tell me how to read a text box in to an array? What I have in the text box is a string of 7 words seperated by spaces. I would like to read each word into an array. Any help would be greatly appreciated! Thanks, Kevin Do you want each word to be in a seperate array or strings? or you want
each word to be in seperate array of chars? or do you want all words to be in one array? If you want all words to be in one array: Dim StringArray() As String StringArray = Me.TextBox1.Text.Split(" ") you will have the following in the StringArray: StringArray(0) = "Word1" String Array(1) = "Word2" StringArray(2) = "Word3" String Array(3) = "Word4" etc If you want to convert them to char array, you can do the following: Dim c() As Char = stringArray(0).toCharArray you can have a 2-D char array and use a loop to populate them or delare 7 arrays. I hope that help Ahmed Kevin O'Brien wrote: Show quoteHide quote > Hello, > > Can someone please tell me how to read a text box in to an array? What I > have in the text box is a string of 7 words seperated by spaces. I would > like to read each word into an array. Any help would be greatly > appreciated! > > Thanks, > Kevin Hi ahmed,
The first solution is exactly what I am looking for and it works great. Thank you for your help and the quick response! Kevin Show quoteHide quote "Ahmed" <ahmed1***@gmail.com> wrote in message news:1151595000.110009.311350@p79g2000cwp.googlegroups.com... > Do you want each word to be in a seperate array or strings? or you want > each word to be in seperate array of chars? or do you want all words to > be in one array? > > If you want all words to be in one array: > > Dim StringArray() As String > StringArray = Me.TextBox1.Text.Split(" ") > > you will have the following in the StringArray: > > StringArray(0) = "Word1" > String Array(1) = "Word2" > StringArray(2) = "Word3" > String Array(3) = "Word4" > etc > > If you want to convert them to char array, you can do the following: > > Dim c() As Char = stringArray(0).toCharArray > > you can have a 2-D char array and use a loop to populate them or delare > 7 arrays. > > I hope that help > > Ahmed > Kevin O'Brien wrote: >> Hello, >> >> Can someone please tell me how to read a text box in to an array? What I >> have in the text box is a string of 7 words seperated by spaces. I would >> like to read each word into an array. Any help would be greatly >> appreciated! >> >> Thanks, >> Kevin > You are welcome :)
Kevin O'Brien wrote: Show quoteHide quote > Hi ahmed, > > The first solution is exactly what I am looking for and it works great. > > Thank you for your help and the quick response! > > Kevin > > > > "Ahmed" <ahmed1***@gmail.com> wrote in message > news:1151595000.110009.311350@p79g2000cwp.googlegroups.com... > > Do you want each word to be in a seperate array or strings? or you want > > each word to be in seperate array of chars? or do you want all words to > > be in one array? > > > > If you want all words to be in one array: > > > > Dim StringArray() As String > > StringArray = Me.TextBox1.Text.Split(" ") > > > > you will have the following in the StringArray: > > > > StringArray(0) = "Word1" > > String Array(1) = "Word2" > > StringArray(2) = "Word3" > > String Array(3) = "Word4" > > etc > > > > If you want to convert them to char array, you can do the following: > > > > Dim c() As Char = stringArray(0).toCharArray > > > > you can have a 2-D char array and use a loop to populate them or delare > > 7 arrays. > > > > I hope that help > > > > Ahmed > > Kevin O'Brien wrote: > >> Hello, > >> > >> Can someone please tell me how to read a text box in to an array? What I > >> have in the text box is a string of 7 words seperated by spaces. I would > >> like to read each word into an array. Any help would be greatly > >> appreciated! > >> > >> Thanks, > >> Kevin > >
+ and & operators
XML Threads do not Terminate! a simply VB.net/ SQL SERVER question DataGridView Question - VB.NET 2005 REGULAR EXPRESSION extract a word and text around it change cursor to hourglass (WaitCursor) between try..catch Icons for explorer app depending on OS GetPrivateProfileString problem! datagrid |
|||||||||||||||||||||||