You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tyberious edited this page Aug 31, 2023
·
1 revision
TextBox Control
The TextBox control lets users input text in the console.
Properties
Value: Gets or sets the current text value of the text box.
X and Y: Specify the position of the text box.
MaxLength: Set the maximum length of the input.
ForegroundColor and BackgroundColor: Customize colors for the text box.
HasFocus: Indicates whether the text box has focus.
IsPassword: Indicates whether the input should be masked (for passwords).
Example
TextBoxusernameBox=newTextBox{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 inputstringuserInput=usernameBox.SetFocus();