By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

How to get/ override usercontrol methods.

P: n/a
Hello All
I am a newbie in VB.NET and wanting to create a toolbar(User Control) for Database Navigation. What exactly I want is to have a user control which is inherited from the system.windows.forms. usercontrol and contain a toolbar which have buttons for navigating records. And the client Windows Form which owns that control must overrides the navigation methods of user control. Forexample to add some custom functionality for moving to first record.
Kind Regards
Syed Zaidi

From http://www.developmentnow.com/g/38_2...nguages-vb.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I would do something like the following (syntax is not guaranteed perfect):

On you UserControl, drop four buttons, lay them out how you want, and name
one btnFirst, btnPrev, btnNext, and btnLast.

Then in the code behind code as follows (Designer generated code left out):

Public Class MyNavControl
Inherits UserControl

Public Enum MovementStep
First
Previous
Next
Last
End Enum

Public Event Navigate(WhichWay As MovementStep)

Public Sub btnClick(sender As Object, e As EventArgs) _
Handles btnFirst.Click, btnPrev.Click, btnNext.Click, btnLast.Click
If sender Is btnFirst Then
RaiseEvent Navigate(MovementStep.First)

ElseIf sender Is btnPrev Then
RaiseEvent Navigate(MovementStep.Previous)

ElseIf sender Is btnNext Then
RaiseEvent Navigate(MovementStep.Next)

ElseIf sender Is btnLast Then
RaiseEvent Navigate(MovementStep.Last)

End If
End Sub
End Class
"Syed Zaidi" <hy**********@yahoo.co.uk> wrote in message
news:e2**********************************@msnews.m icrosoft.com...
Hello All
I am a newbie in VB.NET and wanting to create a toolbar(User
Control) for Database Navigation. What exactly I want is to have a user
control which is inherited from the system.windows.forms. usercontrol and
contain a toolbar which have buttons for navigating records. And the
client Windows Form which owns that control must overrides the navigation
methods of user control. Forexample to add some custom functionality for
moving to first record.
Kind Regards
Syed Zaidi

From
http://www.developmentnow.com/g/38_2...nguages-vb.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Nov 21 '05 #2

P: n/a
Arthur,

Nice

Cor
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.