Search code examples
vb.netwinformsvisual-studiocontrolshungarian-notation

What's the correct alternative to hungarian notation for text box and corresponding label?


In spite of the countless questions asked on StackOverflow and the countless articles I've researched online, I cannot find a clear answer on how to avoid using hungarian notation for a text box and it's corresponding label.

Let's say I name a text box as Username. In the spirit of avoiding Hungarian notation, what could I possibly call its corresponding label?

My only option is run with UsernameTextBox and UsernameLabel but I perceive this as being no different to hungarian notation in principle.

There are endless voices implying that I do not use hungarian notation but none are providing a single alternative.

Note: I already understand what true Hungarian notation is and yes, I'm referring to the wrong but ubiquitous use of it.


Solution

  • If you are seeing advice to avoid Hungarian notation, I believe that is referring to naming your textbox txtUserName, and your label lblUserName. The new convention for winforms appears to be UserNameTextBox and UserNameLabel, which has the advantage of organizing all your UserName objects together in intellisense, for one thing.

    I guess this would be considered Pascal or Camel casing, depending on whether the first letter of your object is capitalized or not.