This project is read-only.

Prompting the User for Information

The ConsoleInput class can be used to easily prompt the user for an additional piece of information during the processing of a command. The methods GetTextResponse(), GetIntegerResponse(), GetDecimalResponse(), GetDateResponse(), and GetYesNoResponse() all take a prompt parameter which is formatted text displayed to the user, and return an appropriately typed result value.

Each of these methods will display the supplied prompt text to the user, show an indented command prompt, and then halt until an acceptable value is provided by the user. Any input which is invalid for the method return type is ignored. The user can only proceed by entering valid input.

Displaying Menus

The ConsoleInput class also provides a GetMenuSelection() method which takes a title and a list of menu item names (IEnumerable(Of String)), and generates a numbered menu for the user to choose from. After the menu is displayed, an indented command prompt is shown and the program halts until a valid menu option is choosen. Any input which is not a valid menu item number is ignored. The user can only proceed by entering a valid menu item number.

This method returns with an instance of a ConsoleInputMenuSelection structure which represents the item the user selelcted and contains the menu item text, number, and index in the source name list .

Last edited May 18, 2012 at 11:30 PM by ReedKimble, version 2


No comments yet.