Results 1 to 3 of 3

Thread: [RESOLVED] Website Search Function

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    44

    Resolved [RESOLVED] Website Search Function

    Hi there, I've just started developing web applications for the first time. Im developing an ASP.Net Website. Ive started transferring code over from my windows application and found a few errors. In my windows application I had a search function in a form where on click the text in a text box would search the first list box and print any matches in the second list box. Here is the code:
    Code:
    lstSearch2.Items.Clear()
            Dim count As Integer = (lstSearch1.Items.Count - 1)
            Dim words As String
            For a = 0 To count
                words = lstSearch1.Items.Item(a)
                If InStr(words.ToLower, txtSearch.Text.ToLower) Then
                    lstSearch2.Items.Add(words)
                End If
            Next
    In my website an error pops up highlighting the line "words = lstSearch1.Items.Item(a)" and says that the value of the list item cannot be converted to string. How do I go about fixing this or is there a different way of implementing a search function in an Asp.Net website?

  2. #2
    Hyperactive Member Grunt's Avatar
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    499

    Re: Website Search Function

    Did you try using .tostring or the cstr function? Not sure if that will work or not but just thought i'd ask.
    My Mobile Software Development Company - http://www.mbpsoftllc.com

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    44

    Re: Website Search Function

    .ToString worked perfect, thanks a million!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width