Hi all,
I'm trying to populate A listview with some data for some time now with no success.
The listview is new to me and cant quite get it to work like I want to.
I've tried many, many things with out any positive results, the only thing that works is ListView1.Items.Add instead of Link or Tr but that only gives me the one row.
Forgive me for my ignorance and any feedback would be greatly appreciated.
Gr
I'm trying to populate A listview with some data for some time now with no success.
The listview is new to me and cant quite get it to work like I want to.
VB.NET:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim theItem As String
Dim wb As New Net.WebClient
Dim src As String
wb.Headers(System.Net.HttpRequestHeader.UserAgent) = "Custom Agent"
theItem = InputBox("Type in the name of the Video file you want to find.", " Video search")
If theItem = "" Then Exit Sub
Me.Cursor = Cursors.WaitCursor
src = wb.DownloadString("http://www" + (theItem) + ".org")
GetLinks(src)
Me.Cursor = Cursors.Default
End Sub
Private Function GetLinks(ByRef HTML As String) As Long
Dim lonRet As Long, lonStart As Long
Dim lonEnd As Long
Dim Tr As String
Dim link As String
Dim ListItem = New ListViewItem()
lonRet = -1
Do
lonStart = InStr(lonStart + 1, HTML, "http://", vbTextCompare)
If lonStart > 0 Then
lonStart = lonStart + 0
lonEnd = InStr(lonStart, HTML, """", CompareMethod.Text)
If lonEnd > 0 Then
lonRet = lonRet + 1
[COLOR=#ff0000] to listview->[/COLOR] Tr = (Mid$(HTML, lonStart, lonEnd - lonStart))
lonStart = lonEnd
lonStart = InStr(lonStart + 1, HTML, "magnet:", vbTextCompare)
If lonStart > 0 Then
lonStart = lonStart + 0
lonEnd = InStr(lonStart, HTML, """", CompareMethod.Text)
If lonEnd > 0 Then
lonRet = lonRet + 1
[COLOR=#ff0000] to listview->[/COLOR] link = (Mid$(HTML, lonStart, lonEnd - lonStart))
lonStart = lonEnd
End If
End If
End If
End If
Loop Until lonStart = 0
Return lonRet + 1
End Function
I've tried many, many things with out any positive results, the only thing that works is ListView1.Items.Add instead of Link or Tr but that only gives me the one row.
Forgive me for my ignorance and any feedback would be greatly appreciated.
Gr