473,395 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Create string array

Hi,
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string array
or ArrayList
since i would not know how many strings are in the TextBox?

Thanks, Ron
Nov 19 '05 #1
5 17092
I think i need to use the Split() method but i am not quite sure how the
syntax would look an example would be most appeciated.
Thanks, Ron

"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:OP******************@tk2msftngp13.phx.gbl...
Hi,
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string array
or ArrayList
since i would not know how many strings are in the TextBox?

Thanks, Ron

Nov 19 '05 #2
Ron:

Search the MSDN for the Split method. It take a char array of delimiters (in
your case, only 1 element: the semicolon), and automatically splits the
string into a string Array. The page in the MSDN has a great example.

HTH
--
Snappy

"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:OP******************@tk2msftngp13.phx.gbl...
Hi,
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string array
or ArrayList
since i would not know how many strings are in the TextBox?

Thanks, Ron

Nov 19 '05 #3
Snappy,
Thanks i will take a look.

"Snappy McFeestleborkenheimer" <wh******@alias.com> wrote in message
news:uI**************@TK2MSFTNGP12.phx.gbl...
Ron:

Search the MSDN for the Split method. It take a char array of delimiters (in your case, only 1 element: the semicolon), and automatically splits the
string into a string Array. The page in the MSDN has a great example.

HTH
--
Snappy

"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:OP******************@tk2msftngp13.phx.gbl...
Hi,
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string array or ArrayList
since i would not know how many strings are in the TextBox?

Thanks, Ron


Nov 19 '05 #4
"RGood" <rgood1@no_spam_4me_woh.rr.com> schrieb
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string
array or ArrayList
since i would not know how many strings are in the TextBox?


Use the string's split method. It returns a string array.
--
Armin

Nov 19 '05 #5
Hi there:

Dim strStringArray() As String = TextBox1.Text.Split(";"c)

strStringArray is your string array, and ";"c means split the string between
the ; chars. Notice the c after the string definition, it means that it's
not a string, it's a char.

--
Happy to help,
-- Tom Spink
(th**********@ntlworld.com)

http://dotnetx.betasafe.com >> On The Mend

Please respond to the newsgroup,
so all can benefit.
One Day,
"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:#V**************@TK2MSFTNGP11.phx.gbl...
I think i need to use the Split() method but i am not quite sure how the
syntax would look an example would be most appeciated.
Thanks, Ron

"RGood" <rgood1@no_spam_4me_woh.rr.com> wrote in message
news:OP******************@tk2msftngp13.phx.gbl...
Hi,
I have a TextBox that contains the following text.

User1;User2;User3; ... and so on.

Each string is seperated by ";".
What is the best way to retreive the strings and place into a string array or ArrayList
since i would not know how many strings are in the TextBox?

Thanks, Ron


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rob Mayo | last post by:
How can I create a pointer to a string array from VB.Net? I want to take a string array of variable size and pass it as a wParam on a message to a custom subclassed window. I've tried wrapping the...
1
by: STeve | last post by:
Hi guys, I was wondering how I would go about creating a string array from a single column from a dataset. What I was thinking was iterate through each row in the dataset, finding out the size...
8
by: Jeff Johnson | last post by:
Hi, I've begun converting an ASP site over to .NET and I'm a novice at both the new platform as well as C#. I have a COM+ object that returns a string array when it is called. The size of...
2
by: rmathieu | last post by:
Hi, I want to initialize a static String array in MC++. What I want to do is to initialize my String array like the C# way: new String {"11", "22"} but I could not find an equivalent in MC++. The...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
17
by: Roshawn | last post by:
Hi, I have a small function that uses a For...Next loop. I am trying to place the results of the loop in a string array. My code is as follows: Dim i as Integer Dim str() as String For i =...
5
by: Paulers | last post by:
Hello all, I have a string array with duplicate elements. I need to create a new string array containing only the unique elements. Is there an easy way to do this? I have tried looping through...
2
by: Big Charles | last post by:
Hello, I would like to create an array-class to be able to call like: Dim oMyCar as New MyCar ' After initializing oMyCar, the object has to be like: oMyCar(0).Brand...
3
by: Morten71 | last post by:
I have a strange problem. I have a local string() var I populate this way: clmns() As String = {"InvoiceNo", "InvoiceDate"} When I call: Array.IndexOf(clmns,"InvoiceDate") I get 0 (zero) as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.