Question: a VB.NET program in MS Visual Studio 2015 that will display the content of a file in a textbox and search targets within the textbox.

a VB.NET program in MS Visual Studio 2015 that will display the content of a file in a textbox and search targets within the textbox.

The Form

The program has one form.

The size of the form is (650, 450), the FormBorderStyle is Fixed3D and it has no ControlBox.

The WindowState is Normal and the StartPosition is CenterScreen.

The AcceptButton is button Open File and the CancelButton is button Exit.

The File Textbox

There is a textbox of size (450, 230) to display the content of a file.

The MultiLine property is True with a vertical scrollbar and the WordWrap is False.

It is centered on the form both horizontally and vertically.

Command Buttons

There are 4 buttons below the file textbox and they all have the default size.

The text is "OPEN FILE", "SEARCH", "NEXT" and "EXIT," respectively. Each button has an access key indicated by the underlined character.

Clicking on the Open File button will display an OpenFileDialog. The InitialDirectory is "C:\temp;" the Filter has two items, the first for all files and the second for VB files, and the second item is selected at the beginning.

If no file is selected, a message box should be displayed; the program goes back to the form without doing any thing after the MessageBox is closed. Otherwise, the content of the file will be displayed in the file textbox, and button Search will get the focus.

Clicking on button Search will display an InputBox for the user to enter the search string. The prompt of the InputBox is "CS234 - Lab3" followed by "Enter a string: " on the next line; the title is "Search Target".

If the user enters a string and then clicks OK, then the program will try to find out if the entered string is in the file textbox. If the search string is found in the file textbox, then the first occurrence of the string in the file textbox will be highlighted and the method ScrollToCaret should be called so the user can see the highlighted text; otherwise a message box will be displayed to indicate the target is not found. If no search string is entered, or button Cancel is clicked, a message box should be displayed to indicate no target is entered.

Button Next is disabled at the beginning. It will be enabled after a search is successful. After the button is clicked, the program will search the next occurrence of the target. If the search is successful, the found occurrence will be highlighted and the user should be able to see the highlighted text without doing anything; otherwise, a message box will be displayed to say the end of file is reached and the button is disabled. Whenever a new search is started (button Search is clicked), button NEXT will be

disabled; it will become enabled or remain disabled depending on if the new search is successful or not.

Clicking on button EXIT will pop up a MsgBox to ask the user "Do you really want to exit?" The MsgBox has two buttons, Yes and No, with information icon. Only when the user clicks on Yes, the program will terminate.

Target Textbox and Label

There is a textbox with a label above the file textbox.

The size of the textbox is (210, 20) and its MultiLine is false.

It's read only, its back color is Window, and it's aligned with the file textbox on the left.

It is cleared when the form is loaded at the beginning and every time the search button is clicked. After a search target is entered, the search target will be displayed in the textbox.

The label is above the textbox and reads "Search Target".

Search Options

A search can be case sensitive or not case sensitive.

There are two radio buttons with a label above the file textbox, to the right of the search target textbox.

The text of the label is "Case Sensitive".

The text of the two buttons is "Yes" and "No" respectively.

When "Yes" is selected, all searches must be case sensitive; otherwise, all searches are not case sensitive.

The case sensitive option can be changed any time, including after a successful search and/or a successful next search. After the option is changed, all following search must be carried out based on the new option.

When the form is loaded, radio button Yes is checked.

Tab Order

Button Open File will have the focus when the program starts.

When the Tab key is pressed, the focus will go to button Search, button Next (when enabled), button Exit, radio buttons, then back to button Open File.

The file textbox will get focus when a search is successful and the target is highlighted.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!