Good Day everybody,
I am wanting to make a program in VB.NET that has many files.doc in a specific folder.
This program has on top a textbox(txtSearch) with a button(btnSearch)
under that this has two listbox(lstOption, lstResult), that are floating a left,
one richtextbox(rtbDoc) that is floating a right.
I want that when the user writes in txtSearch and click on button then the application will read all files, and find for this string.
When it complete:
the first listbox's item are:
All words matches,
Some words matches
initial letter of words matches
Then when the user click on one of this items, then will load all lines where were finds txtsearch.text.
Now when the user clicks on one of this items, then will load the document in the rtbDoc, and if possible thant the rtbDoc(RichtextBox) scroll position on the searched line.
Thank you so much, Have a nice day!
Recommended Answers
Jump to PostSee if this helps to get you started.
1.TextBox,1.Button,1.ListBox,1.ProgressBarImports System.IO Public Class Form1 Private myCoolFilesFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\vb.samples\" Private sT As String = Nothing Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click searchFilesForCoolWords(myCoolFilesFolder, TextBox1.Text, ListBox1) End Sub Private Sub searchFilesForCoolWords(ByVal selCoolFolder As …
Jump to PostTo make things easier, I changed line.20 .From:
selListBoxForResults.Items.Add(Path.GetFileNameWithoutExtension(itm))
.To:selListBoxForResults.Items.Add(Path.[B]GetFileName[/B](itm))
.This will add the .FileName "with" the .FileExtension to your ListBox when loading the search.result Files.
Regarding the ListBox.SelectedIndex and loading the .File with the line selected, see if this helps.:)
Jump to PostIf you did not use the "most".recent code I posted and you just edited the previous.code posted, re.read this:
<<To make things easier, I changed line.20 .From:selListBoxForResults.Items.Add(Path.GetFileNameWithoutExtension(itm))
.To:selListBoxForResults.Items.Add(Path.[B]GetFileName[/B](itm))
.This will add the .FileName "with" the .FileExtension to your ListBox when loading the search.result Files.
SubFolder?
…
Jump to PostIf you were able to load a File into the rtb(RichTextBox), Then .Replace the current.Sub that locates and highlights, w/this one.
Private Sub locateAndHighlightCoolWordFromSearch(ByVal selCoolWord As String, ByVal selCoolRTB As RichTextBox) With selCoolRTB If .HideSelection = True Then .HideSelection = False '// Display Highlighted.Text. .Find(selCoolWord, 0, .TextLength, …
All 14 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.