VB2008 won't let me drag my lblBase class from the toolbox onto a form in design mode. Why? Is there a way around this?

Public Class lblBase
    Inherits System.Windows.Forms.Label
    'Public Sub New()
    'MyBase.new()
    ' Me.BackColor = Me.Parent.BackColor
    'End Sub
End Clas

you cant drag a class into a form, the whole idea of the Class is that you can have various functions relating to one class.

Example

Public Class MyModules

    Public Shared Function getConnectionString() As String
        getConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("TestConnectionString").ToString()
    End Function

So if i want to get the connection string for my database, i would use this code:

myModules.getConnectionString()

As you can see, MyModules is the class, getConnectionString is a function of that class.

Hope that clears it up a bit for you.

- Jordan

Thanks. I just added a method and it works now.

No problem :)

- Jordan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.