Windows Application - SPLessons

Win App Naming Conventions

Home > Lesson > Chapter 4
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Win App Naming Conventions

Windows Application Naming Conventions

shape Introduction

Certain standards have to be followed while naming controls. To give the name to control, one have to set the property called "Name". Every Control has the Name property. Already there is a name by default. Name has to be changed to standard names. Name property gives the id to control. Whenever a code is written, it is useful to identify that control.

Why Standards?

shape Example

This is the question that many beginners asked. This will be explained using an example. When working on a project which have the many text boxes, labels and buttons and an example on Text boxes is taken, the default name for the first Textbox is textbox1. For second text box, it should be textbox2. For third text box, it should be textbox3. While writing code, some problems will be faced while using those text boxes.They are:
  • If same name is given for button and also for the textbox, while writing code there occurs a confusion like which one is the textbox and which one is the button.
  • When a team is working on the same project, one may not know the name given by other team members in a particular control.
These are the problems which occurs if not followed standards for naming the control.

Naming contol

shape Description

Now, see how to name the control. Each control has its own standards. Below table shows some naming conventions for some controls.
Control Name Example Naming Convention
Text Box txtName
Button btnSubmit
CheckBox chkEnglish
Label lblName
Radio Button rdbFemale
ComboBox cmbStates
List Box lstSPlessons Tutorials
Panel pnlLogin
These are the some examples for naming conventions, and it is better to follow these standards from beginning.