Having a problem implementing 'OverRides'

I'm trying to create a derived class for 'Panel' and override the mouse methods as follows:

Public Class CustomPanel
    Inherits Panel
    Private _mousedown As Boolean = False
    Private offsetX, offsetY As Integer

    Protected Shadows Sub OnMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        _mousedown = True
        offsetX = e.X
        offsetY = e.Y
    End Sub

    Protected Shadows Sub MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        _mousedown = False
    End Sub

    Protected Shadows Sub OnMouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If (_mousedown) Then
            Me.Left = e.X + Me.Left - offsetX
            Me.Top = e.Y + Me.Top - offsetY
        End If
    End Sub

End Class

I'm using Shadows there, and it compiles okay. But, those functions never actually fire if I at a break point.

And if I try and change 'Shadows' to 'Overrides' then I get the error:

sub 'OnMouseDown' cannot be declared 'Overrides' because it does not override a sub in a base class.

And it wont compile.
As you can probably tell, I'm simply trying to move the panel around using the mouse.
TIA!      
LVL 11
L00MAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Göran AnderssonCommented:
You have specified a different set of parameters in the method, so you are not overriding the method that exists in the Panel class. This is what the signatures should look like:

Protected Shadows Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)

Protected Shadows Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)

Protected Shadows Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
L00MAuthor Commented:
That worked for the OnMouseUp and OnMouseMove subs, but this:

Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)

Gives me the error:

'Public Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)' cannot override 'Protected Overridable Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)' because they have different access levels.

Any ideas?
0
L00MAuthor Commented:
nevermind. Changed Public to Protected and all is well.

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.