Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Search Box in Visual Basic


Search Box in Visual Basic

Author
Message
bunnyali2011
bunnyali2011
Forum God
Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)

Group: Forum Members
Posts: 4, Visits: 6
Now, imagine there is search box (textbox), and below there are a search button with a rich text box.



My text file located in the drive C is like this:



Product: Cement Size: Big: Cost: 245 Type: Construction

Product: Iron Size: Big Cost: 123 Type: Consruction

Product: Glass Size: Small Cost: 23 Type: Non-Construction

Product: Chocolate Size: Small Cost: 10 Type: Food



I want to search only two types of items in my text file located in drive C, namely: Construction and Non-construction. When the user will type a product name, OR size, OR whatever, he must get results only for the Construction or Non-construction. The user must not get results for the Food. And the user can make misspelling of words in the search, so the Search box must tackle it. And yes, the results should appear on the rich text box on the form itself.



My questions are:





1/ What is the code of doing the Search according the criteria above?

2/ What is the code to put the results on the rich text box?



Thank you!

Perrie
Perrie
Forum God
Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)

Group: Forum Members
Posts: 13, Visits: 308
Ok lots of code required there.

First read in each line to a string variable

pass that to a routine that searches for specific keywords like Construction or food and then returns a true/false on wether that keyword is found or not

then add each line that returns true to an array of strings until the whole file has been scanned

then cycle tyhrough the array and add each line to the rtf object.

bunnyali2011
bunnyali2011
Forum God
Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)

Group: Forum Members
Posts: 4, Visits: 6
The problem I dont know the code, can you tell me if I gave you my object's properties?
CDRIVE
CDRIVE
Forum God
Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)Forum God (103K reputation)

Group: Forum Members
Posts: 548, Visits: 2.6K
bunnyali2011 (3/22/2011)
The problem I dont know the code, can you tell me if I gave you my object's properties?

Since the first thing you have to do is file I/O, do you know how to do that? Your MSDN Library is full of information for you. This example is taken directly from selecting the 'Index' tab and typing "Input".

********************************************************************

Input Function Example

This example uses the Input function to read one character at a time from a file and print it to the Immediate window. This example assumes that TESTFILE is a text file with a few lines of sample data.

Dim MyCharOpen "TESTFILE" For Input As #1   ' Open file.Do While Not EOF(1)   ' Loop until end of file.   MyChar = Input(1, #1)   ' Get one character.   Debug.Print MyChar   ' Print to the Immediate window.LoopClose #1   ' Close file.

 



________________________________________________________________ 

"So much to learn. So little time to do it. Wise men know it's later than one thinks"!

Mark's Syntax.Zip    Pause Sub

I don't answer programming questions via PMs. That's what the forum is for! 

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search