Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Splitting string and adding contents into listview columns.

$
0
0
Hello everyone,

I'm looking at splitting a string which is generated and then inserting the values into a listview.

The string that I'm trying to split will look something like this;
Name:  2WOey.jpg
Views: 37
Size:  16.7 KB

The listview I want to input the values in looks like this;
Name:  2WOeR.png
Views: 28
Size:  23.3 KB

The string is made up of 3 values which is grabbed from a php page which grabs all usernames (and their equivalent emails and ranks) from a MySQL db.
I've currently got it working slightly... and by that I mean it will split the string and insert them into ONLY the first column like above, the full code for this so far is:
Code:

Sub getUsers()

        Dim Str As Stream
        Dim srRead As StreamReader

        Dim req As WebRequest = WebRequest.Create(url)
        Dim resp As WebResponse = req.GetResponse
        Str = resp.GetResponseStream
        srRead = New StreamReader(Str)

        Dim readStr As String = srRead.ReadToEnd

        readStr = readStr.Replace("</table>", "")
        readStr = readStr.Replace("<table>", "")
        readStr = readStr.Replace("<tr>", "")
        readStr = readStr.Replace("<td>", "")
        readStr = readStr.Replace("</tr>", "")
        readStr = readStr.Replace("</td>", "#")

        MsgBox(readStr)

        Dim splitStr() As String = readStr.Split("#")
        Dim split2 As String

        For Each split2 In splitStr

            If split2 = "" Then
            Else
                userList.Items.Add(split2)
            End If

        Next
    End Sub

Can anyone help me out?
Thanks in advanced.
Attached Images
  

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>