Machaira's Blog

Jim Perry's Blog at vbCity

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

JanFebruary 2006Mar
SMTWTFS
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

Articles

Archives

.NET Development Links

Game Development Links

Miscellaneous Links

Thursday, February 23, 2006 #

One thing I see often in the vbCity forums is “How can I make < some control > do this” or “I wish < some control > had < some property >”. One of the best things about .NET is that just about anything can be inherited. Want to add a Tag property to a control that for some reason doesn't have it. No problem:

Public Class EControl
    Inherits OldControl

    Private _tag As String

    Public Property Tag As String
        Get
            Return _tag
        End Get
        Set(ByVal Value As String)
            _tag = Value
        End Set
    End Property

End Class

Doing this won't give you the option of putting the control in your Toolbox but if you want that it's as simple as creating a Windows Control Library project, dropping the control on the UserControl form, resizing the UserControl form to only show the child control, and exposing the child control's properties. The UserControl already has a Tag property, so you don't even have to implement it. Granted, it's sometimes more difficult than this, but it's still not so difficult that you can't whip a control out in a couple of minutes.

Try to think of some functionality you wish the standard controls in either 2003 or 2005 had and we'll see what we can do about whipping some up.

posted @ 9:18 PM