i have 1 text box and 1 button in my application

text box have items like this

24.192.72.54:2779971.163.168.187:4080793.31.71.187:2541*
24.140.130.144:49251*76.15.157.93:16811

now what i want to do? when i press button then txt change in to this format , like this

24.192.72.54:27799
71.163.168.187:40807
93.31.71.187:2541
24.140.130.144:49251
76.15.157.93:16811

some when can help me? please

Recommended Answers

All 5 Replies

Depending on how you want your results, you could use this:

Me.Text1.Text = Replace(Me.Text1.Text, "*", vbCrLf)

This will change the string in-place, but you have to make sure your text box is Multi-Line. Otherwise, it will just display as your string punctuated with unprintable characters.

If you wanted to break your text into usable pieces and keep the parts for later you could use this:

Dim i As Integer
Dim myArray() As String
myArray = Split(Me.Text1.Text, "*")

For i = 0 To UBound(myArray)
    Me.List1.AddItem myArray(i)
Next i

For the sake of illustration, this snippet uses the pieces to load a list box. You could of course do anything you like with them.

Hope these help! Good luck!

thank you problem solved

BitBlt bro u give these codes

Dim i As Integer
Dim myArray() As String
myArray = Split(Me.Text1.Text, "*")
For i = 0 To UBound(myArray)
Me.List1.AddItem myArray(i)
Next i

but these are for lits1

if i want to do same thing with ListView then how it could b done

Different question. Mark this thread "Solved" and open a new thread.

Listview will be working with coloumns and rows etc. Entirely new question, as Bit said, this thread is solved, you need to start a new thread...

Be a part of the DaniWeb community

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