Text Search

  • Date: Feb 2017
  • Category: Software
  • Key Tags: C#, windows application

A .exe program can run on windows to search keyword location in text file.

Introduction

It is a .exe program can run on windows to search keyword location in text file. See project code: Source Code

It is a program that searches a text file for a string. It can find all occurrences of the string and show them in a list. Since the text file could be very long, and lists in C# do not display until the button-press code that fills them exits, the program is multithreaded.

The program can do the following:

  1. Have a textbox for the name of a text file. You can also have a Browse button that will let you find a file to put in the textbox.
  2. Another textbox will accept text to be found in the document.
  3. A search button will cause the document to be searched.
  4. A listview control displays the entire line on which the text was found and the line number within the document.
  5. Search each line of text as you read it for the search string. You should probably do a case-insensitive comparison. Every time the string is found, put the entire line in which it occurs in the list along with its line number. To make it interesting, put in a pause of 100 milliseconds every time you read a line. This will simulate a long document.
  6. The Search button text can be change to “Cancel” once the search starts, and can cancel the operation when pressed.

Additional Functions

  1. When search completed or canceled, show message to remind user.
  2. Show approximate progress when doing research.
  3. When start a new search, clear old search results.
  4. When search is fully completed, the cancel button can also change to search button automatically.