' I want to get some idea about my new project
I my project take the text from web site
to text box and that the code coming like this
#DESCRIPTION ---------- 1 ----------
#SERVICE 1:0:1:1FAD:2454:13E:820000:0:0:0:
#SERVICE 1:0:1:1FAD:2454:13E:820000:0:0:0:
#DESCRIPTION ---------- 2 ----------
#SERVICE 1:0:1:1FAD:2454:13E:820000:0:0:0:
#SERVICE 1:0:1:1FAD:2454:13E:820000:0:0:0:

>>>to end
ok that text now in textbox
and I have list box have two columns one for DESCRIPTION
and the other for SERVICE how I can do that , and also I need code for
find all "text" and delete

Recommended Answers

All 4 Replies

Use the string split to separate each line in the source info, using the # as separator char (this will remove the separator from the response.

The string split, will return an array of strings. Each element of hte array will contain one of the lines.

You will need to define a structure containing the 2 strings for Description and service.

Also tou will need a List, of the structure defined, in order to set it as the source for the list box.
For each line, if the line begins with DESCRIPTION (you can verify it using the IndexOf function) then copy the contents (after DESCRIPTION) to a description variable. Else, create a new variable, of the structure you defined, and fill the first field wir the description variable from the description line, and the second field, with the content (after SERVICE) and add it to the list.

After the last line is processed, set the list as data source for the list box, set the list box multicolumn property to true and refresh it.

Hope this helps

thanks , just i understand the split i need example for that
how can i split by words !?

want this code work with words

Dim words As String() = s.Split(New Char() {" "c})

to split #SERVICE fo exam

It will split the line in as many words exist separated by a blank.

The first word (index 0 ) will contain the keyword. The rest of words (from 1 to the last) will contain other words in the input, if there is any other blank in the line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.