Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Using and Creating properties in visual Studio Dot net 2005

Author: Zunnair

In this article I want to explain the way in which we can distinguish between different properties and can create properties.

In this article first I want to explain the kinds of properties.

There are mainly two kinds of properties usually used in Dot Net.

  • Default Property
  • Private Property


First I want to tell you regarding default property but remember that default property are not useful as private or custom properties.


There's are some  important caveats regarding default properties.  You can only define Indexed Properties as Default.  In VB6 this wasn't the case.  Think about the label and textbox controls. In VB6 you could write myControl = "My Control" but in the .NET languages, the .Caption property isn't indexed, therefore not default.  In addition, you can't declare Shared or Private Properties as Default.  Finally, you can only have one default property per class.  This makes sense after all, how else would the developer or compiler know what you wanted to do?  


Now Secondly I wanna discuss regarding Private or custom property,  The most common property that you use with it is probably the .text property.  The .enabled and .visible properties are two other common ones.  Well, it's pretty common to use the TextChanged event to validate your input and often times enable other controls based on its validity (there are other ways to accomplish this, but I'm just trying to use a common example


private int ID





                if (ViewState["ID"] == null)

                    ViewState["ID"] = int.Parse(ParentID);

                return (int)ViewState["ID"];




                   ViewState["ID"] = value;




  ID = oDS.tblUsgItm[0].UsgID;

//Simple Assigning Like Variable


This is a simple article for new comers of dot net, I hope this article is useful for you all


Add Article Comment:
Name :
Email Address :
Comments :
<< Creating and loading Drop Down list using C# in Visual Studio 2005

Disclaimer - Privacy
© 2002-2017