Showing results for 
Search instead for 
Did you mean: 
Super User
Super User

Naming conventions for controls, any tips?

Interested to know what others do about naming conventions for controls.



I'm coming from an Access background for forms creation where control names only have to be unique to their parent form. You tend to reference a control by its parent form, e.g. MyForm.MyControl. 


In PowerApps every control name must be unique, but I frequently have the 'same' control on multiple screens (e.g. Control 'CustomerName' may appear in a New Customer screen, Edit Customer screen, Customer Gallery screen and so on).


I've taken to prefixing every Control name with the name of the screen on which it appears and giving every screen a name related to its function/data, e.g. scnNewCustomer.DataCardCustomerName. This results in very long-winded control names, but at least avoids name clashes and confusion when reading formulae. 


Power Participant
Power Participant

I'm doing it in a similar way, but I tend to put hte screen name last, and have an abbreviation of the type of control first, so a label on the main screen would be namned lblAccountHdrscrMain, a drop down would be ddAccountList etc. Furthermore I group items a lot, and the group's name will start with grp and then something descriptive, like grpAccountInfo. I haven't done that many apps yet though, so I tend to experiment a bit and change things around.


It certainly does not make for short namnes, but I think it will be easier to maintain in the long run, especially if someone else takes over. If there is something I strongly dislike it's going through undocumented and poorly written code!


One thing I miss (or have missed how to do) is the ability to search and replace names of global variables once they are being used. Examnple: I used Set(nLeftMargin, 4) in an app with lots of fields and rectangles but as things evolved, as they tend to do, I use the same variabel for both left and right margin as well as spacing within fields, so I'd like to change name to reflect this. Now I have used it in too many places so it's not really possible without putting a lot of time into it.





In having worked with Access for almost 25 years and counting ... I can appreciate the need for Naming Conventions ala the original Leszynski/Reddick Naming Conventions back in the day.


"but at least avoids name clashes and confusion when reading formulae. "

Exactly !  

At this point in PowerApps relatively short existence ... using ANY sort of consistent naming convention will be ahead of the game.My conventions are still a moving target which each new app I do ... as new elements (objects/controls) are put in use 🙂



DatabaseMX ('mx')
Microsoft Access MVP
Not applicable

"In PowerApps every control name must be unique" ==> why is this?

Super User
Super User

In, for example, MS Access, a control name only needs to be unique to the screen (form) on which it appears. When you reference a control it is assumed to be on the same form unless you qualify the reference by giving the form name followed by a period followed by the control name.
In PowerApps you don't qualify a reference with the form name, so every control name must be unique. If two or more controls had the same name, how would the system know which you were referencing? Perhaps think of it like cells in Excel. Every one has a unique 'name'.
Advocate I
Advocate I

Tend to use ScreenControlDescription e.g. a label on the home screen for users would be HsLblUsers


Makes it easier when reading though code to know whats being reffered to & also if you were looking for a label on the home screen you'd just type HsLbl and it would list all 🙂

Advocate III
Advocate III

Overall, I suggest adopting a *consistent* naming convention for yourself and use it.

DatabaseMX ('mx')
Microsoft Access MVP

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,883)