|
-
Jun 28th, 2011, 05:59 AM
#1
Thread Starter
Member
[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?
-
Jun 28th, 2011, 11:23 AM
#2
Hyperactive Member
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.
-
Jun 29th, 2011, 03:15 AM
#3
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|