Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default .NET control names

Status
Not open for further replies.

TerryMc

IS-IT--Management
Apr 29, 2002
19
CA
Does anyone know if there is a way I can change the default control names for VB.Net or for anything in Visual Studio for that matter.

I would like to create a custom standardized default naming such as txt1, txt2.. instead of Text1, Text... for newly added controls.

Thanks
 
yes, you find it in the properties of the control in the design view. It't the Name property.

/icca
 
I don't think that's what TerryMC meant, I think he wants to make it so that when a control is initialized, it's name defaults to ...whatever, instead of the normal Label1, Text1, etc.

Not sure if you can do this, however - you could cheat by creating a custom control (named txt1 or whatever) and just inherit from the control that you want... ie:

Code:
Public Class myDefaultUserControlName
   Inherits System.Windows.Forms.Textbox
End Class

Pete
 
Thanks Pete

You are on to what I am talking about. I guess what I want is to be able to set some default naming preferences so I can take less time renaming when I add controls.

I think your custom control idea may be on the right track and will give it a look.

Terry
 
Could you write a VS macro to rename them? If it sees "Text(n)", it replaces it with "txt(n)".

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top