Understanding VB .NET User Controls

VB.Net user controls are those controls that have other controls in them so that they provide a complex functionality if needed. Combining controls to form a VB.Net user control helps you to modularize the code that you are developing for your project.

User controls are created as .ascx file and these are added to the project in the bin directory of the project. After you create a user control you can add them to the tool palette so that you can use them just like any other control in the tool box.

For example you can combine a label and a textbox to create a user control. So whenever you drag and drop this user control from the toolbox you get a label and a textbox together.

You can use the get and set routines to get the properties of the label and the textbox and to set the properties of the toolbox. Sample ‘get and set’ routine is given below, for a textbox and label combination in a user control.

Public Property sampText() As String
Get
sampText = TextBox1.Text
End Get
Set(ByVal samptxtValue As String)
TextBox1.Text = samptxtValue
End Set
End Property
Public Property sampLbl() As String
Get
sampLbl = Label1.Text
End Get
Set(ByVal samplblValue As String)
Label1.Text = samplblValue
End Set
End Property

Similarly you can use different properties for the controls available in a user control.


Research and Markets: Professional Visual Basic 2010 and .NET 4
DUBLIN--(BUSINESS WIRE)--Research and Markets (http://www.researchandmarkets.com/research/73acf6/professional_visua) has announced the addition of John Wiley and Sons Ltd's new report "Professional Visual Basic 2010 and .NET 4" to their offering. Intermediate and advanced coverage of Visual Basic 2010 and .NET 4 for professional developers If you've already covered the ...

Research and Markets: Mastering Microsoft Visual Basic 2010
DUBLIN--(BUSINESS WIRE)--Research and Markets (http://www.researchandmarkets.com/research/dcf284/mastering_microsof) has announced the addition of John Wiley and Sons Ltd's new report "Mastering Microsoft Visual Basic 2010" to their offering. The new edition of the ultimate comprehensive guide to Microsoft Visual Basic Where most VB books start with beginner level ...




______________________________________________________

Recommended Resource



| Converting Web Pages to User Controls in .NET | .Working on .NET User Controls | Overview of ASP.NET User Controls | Web User Controls - Creation and Implementation | Advantages of using User Controls in ASP.NET | Re-usability of User Controls in ASP.NET | Personalizing Web Application by Creating User Controls in .NET | Customizing your Application with VB.net User Controls | Building User Controls in ASP.NET | Examples of User Controls in VB.NET | Example of C# User Controls | Where to use Visual Basic User Controls | Working on User Interface Controls | Creating Dynamic User Controls | Understanding VB .NET User Controls | Creating User Controls VB.NET | How to load user controls dynamically |



_______________

FREE Subscription

Stay Current With the Latest Technology Developments Realted to .NET. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.


 

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |