[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?
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.
Re: Website Search Function
.ToString worked perfect, thanks a million!