Click here to Skip to main content
15,919,178 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After adding any control or object to form from datasource or toolbox, vb postfixes object type name to that control e.g. for Name field NameTextBox, for Component like Data Adapter say AddresesDataAdapter, AddresesBindingSource and so on.

Here i want to ask you that may i change this default way to identify the object i.e. may i set prefixes desired for diffrent objects.

Say txt prefix for textbox control, lbl for label control, cbo for Combo Box,ta for Table Adapter, bs for Binding Source & so on. Thanks.
Posted
Updated 14-Jun-10 18:46pm
v2

1 solution

liliane10 wrote:
After adding any control or object to form from datasource or toolbox, vb postfixes object type name to that control e.g. for Name field NameTextBox, for Component like Data Adapter say AddresesDataAdapter, AddresesBindingSource and so on.


I don't think this is true. If you drag a text box from tool box by default in VB.NET the name will be TextBox1 and in C# it will be textBox1, how come the .NET know that you want to use this text box for Name? This you need to change.

liliane10 wrote:
Here i want to ask you that may i change this default way to identify the object i.e. may i set prefixes desired for diffrent objects.

Say txt prefix for textbox control, lbl for label control, cbo for Combo Box,ta for Table Adapter, bs for Binding Source & so on. Thanks.



This is entirely depends on you preference and choice. If you are working on an existing application then follow the existing naming convention and if you are starting a new application then use as per your choice. But I will suggest if your are working on a project using .NET then follow Microsoft guidelines for the naming convention.

http://msdn.microsoft.com/en-us/library/0b283bse(VS.71).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900