Using the TextBox control in WinForms

   

In this part of the tutorials we shall learn how to use the TextBox control in WinForms!

If you haven't seen the Part 4 of this series of C Sharp Learning, then click here

First, create a new project or use the Project we used in Part 2:

Then drag the TextBox control from the ToolBox into the Form (Form1):


Now let us go through few of it's properties:

BackColor:

You can change the background color of the textbox with the help of the BackColor property:




BorderStyle:

If you want to change the way your TextBox looks, then you can use the BorderStyle property to change if your textbox has a border or should look 3D!:



CharacterCasing:

The textbox can also be set to take in only lower-case or upper-case characters and both! This can be achieved with the CharacterCasing property:



Font:

This property is present in almost every control in WinForms! Just choose your Font:



ForeColor:

ForeColor property sets the text color of the TextBox


MaxLength:

The MaxLength property sets the maximum length of characters which can be entered into the TextBox:



PasswordChar:

The PasswordChar which abbreviates to password character is a property which will set the password feature to the textbox. Just enter a "*" in that property, run your app and see the magic!

PlaceholderText:

The PlaceHolderText property sets the placeholder text of the TextBox. This text is set in gray color and will disappear if the textbox has more than 1 character and will appear back if it has 0 characters

Text & TextAlign:

The text property obviously sets the text of the TextBox and the TextAlignment changes the alignment of the text


So I hope this helps!

For the previous tutorial, click here

The next part is a simple and fun activity which is coming soon!

Comments

Popular posts from this blog

Getting Started With Coding

Using the CheckBox control in WinForms

Using the Button Control in WinForms