Set Server Controls Properties in C# Windows Forms



Properties of Server Side Controls

In Previous c#.net tutorial we seen how to add server side control on windows form in windows application. Now after adding control on windows form we have to set all controls properties and events. Each server side controls have a different types of properties and events.


Set Server controls Properties

In this c# windows post we will learn to set and change properties of server side controls. The properties are used to design and identification purpose of controls. Let’s understand how to set properties to server side control with an example.

Here, we add a TextBox control on windows form and set properties of TextBox control.

TextBox Control –> Right Click –> Properties
or
Select TextBox Control –> Press F4 Key

Now open visual studio, create new windows application and textbox control on windows form as shows in below figure.

meeraacademy.com
Set Server controls properties in windows application.

Below screen shows the properties of TextBox control, properties are like ID, BackColor, BorderStyle, Text, Width, Height etc….

meeraacademy.com
Set Server controls properties in windows application.

Set properties list in alphabetical order in windows application.

For view the properties list in alphabetical order, click A-Z Symbol at the top of the property screen like below screen.

meeraacademy.com
Set properties list in alphabetical order in windows application.

Now, let’s change some properties of textbox control with an example.

Set back ground color of textbox control

Now, change any property from property list of textbox control, it will make changes on textbox control. If we want to change back ground color of textbox control, then go to BackColor property and select color as you wish.

Select TextBox –> Properties –> BackColor = Green

meeraacademy.com
Set back ground color of textbox control

Set Font color of textbox control

If we want to change font color of any control in windows application then we have to set ForColor properties of controls.

Select TextBox –> Properties –>ForeColor = Yellow
Select TextBox –> Properties –> Text = MEERA

meeraacademy.com
Change font color of textbox in windows application.

In above figure, we have changed textbox control ForColor properties for change text font color of textbox. We also change textbox Text properties for display text in textbox control.

We hope that this c#.net windows application helped you to understand about set properties of server side control in visual studio.


Next, c# windows application post we will learn about write server side C# code in code behind.


 

Leave a Reply

Your email address will not be published. Required fields are marked *