Hi Bernard,
Off the top of my head, I would think about adding a public boolean property (you could even call it DoDefault if you'd like to <g>), set it to true, then have your PreClick EventHandler set it to false if you need to.
~~Bonnie
>Hi Bonnie
>
>Many thanks for the help, it's certainly helped me a great deal, and it's good to fnid somebody who can relate how we used to do things in foxpro and relate them to .net.
>
>Using your suggestions I've managed to implement a pre and post click type method on my command button class.
>
>However, I've got a problem attempting to abstract the default click code out of parent class. eg ;
>
>Here's my parent command button class :
>
>
>Public Class BaseCommandButton
> Inherits System.Windows.Forms.UserControl
> Public Event PreClick As EventHandler
> Public Event PostClick As EventHandler
>
> Private Sub BaseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BaseButton.Click
> RaiseEvent PreClick(sender, e)
>
> '------------------default code goes here---------------------
> MsgBox("parent click at class level")
> '------------------default code goes here---------------------
>
> RaiseEvent PostClick(sender, e)
> End Sub
>End Class
>
>
>As you can see I'm raising events both before and after the click takes place so that I can perform code at a subclass level before and after the click takes place.
>
>So, when I drop this commandbutton on my form , I can do the following to provide hooks to the pre and post click methods.
>
>
>Public Class SubClassedForm
> Inherits BaseClasses.BaseForm
>
> Public Sub MyPreClickCode(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BaseCommandButton1.PreClick
> MsgBox("Preclick")
> End Sub
>
> Public Sub MyPostClickCode(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BaseCommandButton1.PostClick
> MsgBox("PostClick")
> End Sub
>
>End Class
>
>
>This works great, but what I'm trying to achieve is to prevent this default parent code
>
>
> '------------------default code goes here---------------------
> MsgBox("parent click at class level")
> '------------------default code goes here---------------------
>
>
>from running if necessary, or maybe override it. For example something happens in my preclick method and I then decide to abort the action etc.
>
>I can create another event at the parent class level and raise this event in the parents click method , but I'm having difficultly placing the default code some place in the parent class.
>
>I'd be really grateful if you could keep my .NET learing curve moving!
>
>All the best, Bernard....