Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with new class that inherits from a label

Status
Not open for further replies.

Sorwen

Technical User
Joined
Nov 30, 2002
Messages
1,641
Location
US
I've had limited experience with classes and had a lot of help with my last one that inherited from a panel. I didn't have any special properties. Now what I need is a special label class. There a lot of ways I could do this rather than a label (some likely better), but what I want in this instance is a label that has extra properties. Basically it is a special label to hold file information. The .Text property from the basic label will hold the file name (as only the name has to be displayed), but then I need directory info of where the file was found, maybe the size, and then anything else I decide. The final result is multiple of these "flabel" will be in a collection and I will always be dealing with these collections.

Here is the code so far:
Code:
Public Class flabel_class
    Private nDirectory As String
    Private nFileSize As Long

    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub

    Private Sub InitializeComponent()

    End Sub

    Protected Overrides Sub Finalize()

    End Sub

    Public Property Directory() As String
        Get
            Return nDirectory
        End Get
        Set(ByVal value As String)
            nDirectory = value
        End Set
    End Property

    Public Property FileSize() As Long
        Get
            Return nFileSize
        End Get
        Set(ByVal value As Long)
            nFileSize = value
        End Set
    End Property

End Class

My problem is I cannot use the Properties it Inherited from the base Label (i.e. .Name, .Text, etc). What am I doing wrong?

-I hate Microsoft!
-Forever and always forward.
 
Code:
Public Class flabel_class

should be

Code:
Public Class flabel_class inherits system.windows.forms.label

or something like that, I'm not positive on the namespace.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
DOH! I forgot to add the line back in when I changed it from a component class to a class. That was really stupid of me. Thanks!

-I hate Microsoft!
-Forever and always forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top