Sub "NotInheritable"

PROKA

Junior Contributor
Joined
Sep 3, 2003
Messages
249
Location
Bucharest
I have a 'form1' form (a class) with a Button1_click Sub on it
How do I make this sub NotInheritable ? ( I have another form (form2) , Inheriting form1 and I want to put in another code for Button1_click )
 
in The 2nd form, I want to write another code for Button1_sub

for example, if in form 1, Button1_sub does Msgbox("Form1,Button1") and I inherit form 1 ( in form 2 ) it will do the same

well , I want the button in form 2 to do msgbox("Form2,button1")
 
In form2 you don't need the Handles Button1.Click on the following line
Visual Basic:
Protected Overrides Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

The event is already being handled by the base class' Handles statement. Remove the handles clause and things sould now work.
 
Back
Top