Important alert: (current site time 7/16/2013 1:54:46 AM EDT)
 

VB icon

[ A Working Search Engine ]

Email
Submitted on: 4/8/2005 2:58:41 PM
By: Power Of Anubis 
Level: Beginner
User Rating: By 6 Users
Compatibility: VB 6.0
Views: 22246
author picture
(About the author)
 
     A working search engine for text boxes, TESTED! Write something in a text box and it will tell you if the item exists!!! Try It, And Vote It. You must create 1 text box 1 button 1 list box
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: [ A Working Search Engine ]
' Description:A working search engine for text boxes, TESTED!
Write something in a text box and it will tell you if the item exists!!! Try It, And Vote It.
You must create 1 text box 1 button 1 list box
' By: Power Of Anubis
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59893&lngWId=1'for details.'**************************************

Private Sub Command1_Click()
List1.ListIndex = 0
For i = 0 To List1.ListCount - 1
If List1 = Text1.Text Then
MsgBox "Found"
Exit Sub
Else
If List1.ListIndex = List1.ListCount - 1 Then
MsgBox "Not Found"
Exit Sub
Else
List1.ListIndex = List1.ListIndex + 1
End If
End If
Next i
End Sub
Private Sub Form_Load()
MsgBox "Vote If You Like"
List1.AddItem "nironsoft"
List1.AddItem "volen"
List1.AddItem "notbad?"
List1.AddItem "volencho"
List1.AddItem "NironSoft"
List1.AddItem "Cool"
List1.AddItem "searchengine"
List1.AddItem "search"
List1.AddItem "tape something"
List1.AddItem "awesome"
List1.AddItem "yeah"
End Sub


Other 10 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/8/2005 3:06:26 PMPower Of Anubis

Only one problem for the moment:
if you write "nironsoft" it will find, but if you write "Nironsoft" it will not find
But I will change that...
(If this comment was disrespectful, please report it.)

 
4/8/2005 5:24:40 PMAndrew M. Goncharov

Try it with 10 000 items in listbox, and you`ll decide to use SendMEssage. Your example is too slow and 'cheap' to be an engine. IMHO.

PS. Do you know such operator: StrComp?

;-)
(If this comment was disrespectful, please report it.)

 
4/8/2005 8:00:07 PMDaniel W Elkins

This isn't a search engine at all. It's a loop to scan through a listbox control. And as Andrew said, it's a poor way to do it, use SendMessage() and it finds it almost instantly. If you don't want the "search" to be case-sensitive, use LCase$() or UCase$() to compare the current item with the current search query. Ie: If LCase$(List1.List(1)) = LCase$(Text1.Text) Then MsgBox "Found"
(If this comment was disrespectful, please report it.)

 
5/10/2005 3:55:15 PM.netLimit Productions

or even instr(start,string to find,string to search in)
(If this comment was disrespectful, please report it.)

 
10/26/2005 12:34:18 AMAK singh

It is so helpful.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.