-
Notifications
You must be signed in to change notification settings - Fork 0
TextBox
Tyberious edited this page Aug 31, 2023
·
1 revision
The TextBox control lets users input text in the console.
-
Value: Gets or sets the current text value of the text box. -
XandY: Specify the position of the text box. -
MaxLength: Set the maximum length of the input. -
ForegroundColorandBackgroundColor: Customize colors for the text box. -
HasFocus: Indicates whether the text box has focus. -
IsPassword: Indicates whether the input should be masked (for passwords).
TextBox usernameBox = new TextBox
{
X = 10,
Y = 15,
MaxLength = 20,
ForegroundColor = ConsoleColor.Black,
BackgroundColor = ConsoleColor.Gray
//A default value for the textbox can be set by assigning the 'Value' property here before we call the SetFocus() method
};
usernameBox.Render();
// Capture user input
string userInput = usernameBox.SetFocus();