I have a custom control set up like this
[code]
Public Class ctrlAddSitesMenu
'Declares Buttons for Opening Websites
Dim OpenTraker As New Button
Dim OpenDynamics As New Button
Dim OpenInetPortal As New Button
Dim OpenFrontPortal As New Button
Dim OpenLoopcare As New Button
Dim OpenViryNet As New Button
Dim OpenSmpl As New Button
Dim OpenFosWiki As New Button
Dim OpenLola As New Button
'Declare Button Constant Varibles
Dim LocX As Integer = 0
Dim LocY As Integer = 20
Dim Row As Integer = 25
Dim H As Integer = 25
Dim W As Integer = 115
Public Sub LoadButtons()
'Declares attributes for Invidual buttons
'Declares Button names
OpenTraker.Name = "btnOpenTracker"
OpenDynamics.Name = "btnOpenDynamics"
OpenInetPortal.Name = "btnInetPortal"
OpenFrontPortal.Name = "btnFrontPortal"
OpenLoopcare.Name = "btnOpenLoopcare"
OpenViryNet.Name = "btnOpenVirynet"
OpenSmpl.Name = "btnOpenSimple"
OpenFosWiki.Name = "btnOpenFosWiki"
OpenLola.Name = "btnOpenLola"
'Declares Button text
OpenTraker.Text = "Tracker"
OpenDynamics.Text = "Dynamics"
OpenInetPortal.Text = "Internet Portal"
OpenFrontPortal.Text = "Frontier Portal"
OpenLoopcare.Text = "Loopcare"
OpenViryNet.Text = "Virynet"
OpenSmpl.Text = "SIMPL"
OpenFosWiki.Text = "FosWiki"
OpenLola.Text = "Lola"
'Declares Button Size
OpenTraker.Size = New Size(W, H)
OpenDynamics.Size = New Size(W, H)
OpenInetPortal.Size = New Size(W, H)
OpenFrontPortal.Size = New Size(W, H)
OpenLoopcare.Size = New Size(W, H)
OpenViryNet.Size = New Size(W, H)
OpenSmpl.Size = New Size(W, H)
OpenFosWiki.Size = New Size(W, H)
OpenLola.Size = New Size(W, H)
' Declares Button Location
OpenTraker.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenDynamics.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenInetPortal.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenFrontPortal.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenLoopcare.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenViryNet.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenSmpl.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenFosWiki.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
OpenLola.Location = New System.Drawing.Point(LocX, LocY)
LocY += Row
'Adds Buttons to Menu
Me.Controls.Add(OpenTraker)
Me.Controls.Add(OpenDynamics)
Me.Controls.Add(OpenInetPortal)
Me.Controls.Add(OpenFrontPortal)
Me.Controls.Add(OpenLoopcare)
Me.Controls.Add(OpenViryNet)
Me.Controls.Add(OpenSmpl)
Me.Controls.Add(OpenFosWiki)
Me.Controls.Add(OpenLola)
'Adds Button Click Handlers
AddHandler OpenTraker.Click, AddressOf OpenTrackerClick
AddHandler OpenDynamics.Click, AddressOf OpenDynamicsClick
AddHandler OpenInetPortal.Click, AddressOf OpenInetPortalClick
AddHandler OpenFrontPortal.Click, AddressOf OpenFrontPortalClick
AddHandler OpenLoopcare.Click, AddressOf OpenLoopcareClick
AddHandler OpenViryNet.Click, AddressOf OpenViryNetClick
AddHandler OpenSmpl.Click, AddressOf OpenSmplClick
AddHandler OpenFosWiki.Click, AddressOf OpenFosWikiClick
AddHandler OpenLola.Click, AddressOf OpenLolaClick
End Sub
Private Sub addSitesMenu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Catch ex As Exception
End Try
End Sub
Private Sub OpenTrackerClick(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("OpenTracker Button Clicked")
End Sub
End Class
IN order to clean thing up a bit, I want to move The "LoadButtons" Class to a different file, I assume it would be a class file.
Two things happen I get an error in the Addhandler saying the Open*****Click ins not declared. I also cant seem to figure out how to properly call it.
I have tried
Try
LoadButtons()
Catch ex As Exception
End Try
and
Try
classname.LoadButtons()
Catch ex As Exception
End Try
I have also tried
Imports Classname
None of which is working. I do know the Addcontrols has to go on the main form. As for the rest, I am so lost