Search a textbox for particular text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BarryM
    New Member
    • Mar 2008
    • 32

    Search a textbox for particular text

    hi in a project that im working on i load a web page source into a textbox and then from that text i try to find files on the web page and then makes a new item in a listbox with the file name text as the item text e.g(http://bytes.com/images/logo4.gif) (then you can download the file). I kinda got a way of doin it but it doesent work any good. The download part works perfect its just the finding files in the source.

    I came up with this coding and there are 4 things wrong with it
    1. way to long
    2.doesent always find files
    3. mostly it comes up with stuff like "httpgif"
    4. sometimes come up with errors


    [code=vbnet] Dim flv_reader As String = String.Empty
    Dim e As Integer = 0
    Dim flv_eq As Integer = 0
    Dim flv_dot As Integer = 0
    Dim flv_file As String = String.Empty
    For e = 0 To txts.Lines.Leng th - 1
    flv_reader = txts.Lines(e)
    'find the .swf
    If flv_reader.Cont ains(".flv") Then
    'find the :
    Dim f As Integer = 0
    For f = 0 To flv_reader.Leng th - 1
    If flv_reader.Char s(f) = ":" Then
    flv_eq = f
    End If
    Next
    'find the .
    Dim g As Integer = flv_eq
    For g = flv_eq To flv_reader.Leng th - 1
    If flv_reader.Char s(g) = "." Then
    flv_dot = g
    End If
    Next
    'Me.Text = swf_dot
    'get text betwwen the 2
    Dim h As Integer = 0
    For h = flv_eq To flv_dot
    flv_file += flv_reader.Char s(h)
    Next
    'add http and swf
    flv_file = "http" + flv_file + "flv"
    'clean the search
    If flv_file.Contai ns("<") = False Then
    If flv_file.Contai ns("""") = False Then
    lstfiles.Items. Add(flv_file)
    End If
    End If
    End If
    Next
    [/code]
    Last edited by debasisdas; Apr 11 '08, 06:19 AM. Reason: added code=vbnet tags
Working...