Click here to Skip to main content
Click here to Skip to main content

Automate code-writing in VB.NET control's development

, 11 Aug 2004
Rate this:
Please Sign up or sign in to vote.
Utility for automating code writing for VB.NET control's developers

Introduction

When you develop a new control in .NET Framework often reuse standard controls as textboxes , buttons etc…

Commonly we have to replicate, at control level , properties of a child control and is a very tedious work to hand-write the code for all hosted properties.

Details

Look, for example at this control

sample control

Probably the Control should have properties similar to child controls

In this case, for example, Control's Text property should be textbox property

Well so you must manually rewrite all properties statements in this way:

Public Property BoxText() As String
        Get
            Return Me.TextBox1.Text
        End Get
        Set(ByVal Value As String)
            Me.TextBox1.Text = Value
        End Set
 End Property

That is a very tedious work, considering that much properties as similars (like Font, Background and so on)

Class Inspector

Class Inspector can spy and recreate properties declarations of controls, components enums and other classes containeds in an assembly.

You can load any .NET assembly and in the left treeView will be loaded all assembly referenced in it (if you don't specify an assembly with menu item "File/Get references from an assembly" will be loaded the program assembly itself).

You can now navigate in tree nodes to class/enum that you want inspect and, by clicking on this, in right text panel will be appears VB code for properties declararations of inspected class.

The code can be browsed,copied and saved. You can also define a Prefix for properties names, so if you define i.e. Btn the Text property declaration appear as

'Text
'
Private _BtnText as System.String
<Description("The text contained in the control.")> _
Public  Property BtnText as System.String
   Get
       return _BtnText
   End Get
   Set (Value as System.String)
       _BtnText=Value
   End Set
End Property

You can, moreover, define a language different from default (English) by setting relative combobox

If i.e. I set language to Italian (and if my .NET framework distribution supports this language) the precendent property declaration will appears as

'Text
'
Private _BtnText as System.String
<Description("Il testo contenuto nel controllo.")> _
Public  Property BtnText as System.String
   Get
       return _BtnText
   End Get
   Set (Value as System.String)
       _BtnText=Value
   End Set
End Property

That is Description attributes will be translate in the selected language.

Remarks

The source project was written with Visual Studio 2003 and the program was tested with .NET framework v.1.1

In my site is also avaible a setup package

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Francesco Smelzo
Web Developer
Italy Italy
Francesco Smelzo is a free-lance developer that live and work in Italy,he is specialized on microsoft platform development and in web projects.
 
He is specially skilled on VB.NET, XML,XSL and most of web scripting languages.

Comments and Discussions

 
GeneralMy vote of 5 Pinmemberaaroncampf31-Dec-10 19:01 
Generalhehehehe..... Pinmembernoor_adilah11-Feb-07 18:15 
GeneralGreat PinmemberaKriss6-Feb-05 16:45 
GeneralSweet PinmemberAaron Eldreth12-Aug-04 6:24 
GeneralRe: Sweet PinmemberFrancesco Smelzo12-Aug-04 6:58 
GeneralRe: Sweet PinmemberAaron Eldreth12-Aug-04 8:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 12 Aug 2004
Article Copyright 2004 by Francesco Smelzo
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid