-
-
Notifications
You must be signed in to change notification settings - Fork 5
ValueInput Control
Iuga Alexandru edited this page Sep 2, 2018
·
2 revisions
Reads a value from the Console input.
- Custom label - Displays a label before the user types the value.
- Custom space amount between label and value
- Optional default value - Specify a value to be used if the user press Enter without typing anythig (string empty).
- Custom error message for type conversion - When the input string cannot be converted into the requested type.
- Generic control - Reads any type of data.
- Custom label color - Specify the foreground and background colors for the label.
string firstName = ValueView<string>.QuickRead("First Name:");
Result:
ValueView<string> firstNameInput = new ValueView<string>("First Name:");
firstNameInput.LabelForegroundColor = ConsoleColor.Cyan;
string firstName = firstNameInput.Read();
Result:
ValueView<int> numberInput = new ValueView<int>("Number:");
numberInput.AcceptDefaultValue = true;
numberInput.DefaultValue = 42;
int number = numberInput.Read();