|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Inheritance doubt.Hello All,
I am planning to use inheritance for forms which have similar controls and properties. I tried to do it with a small example, but I am facing some issues. I created a base form (with 2 butttons) with overridable event procedures. In the inheritance I created a 2 overriding event procedures. The startup object was the base form. In the base form button2 procedure I am calling the inherited form. The inherited form loads but the inherited form button2 procedure fires twice. Why is that? Please help me. thank you in advance. Ravi Ravimama wrote:
> Hello All, I suspect you might be doing this:> > I am planning to use inheritance for forms which have similar controls > and properties. I tried to do it with a small example, but I am facing > some issues. > > I created a base form (with 2 butttons) with overridable event > procedures. In the inheritance I created a 2 overriding event > procedures. The startup object was the base form. In the base form > button2 procedure I am calling the inherited form. The inherited form > loads but the inherited form button2 procedure fires twice. Why is > that? Please help me. base form: Overrideable Sub Button2_Click(sender, e) Handles Button2.Click 'base button2 click behaviour End Sub derived form: Overrides Sub Button2_Click(sender, e) Handles Button2.Click 'derived button2 click behaviour End Sub Because there are two Handles clauses, they will BOTH be called on Button2.Click. What you should do is this: base form: Sub Button2_Click(sender, e) Handles Button2.Click OnButton2Click End Sub Protected Overrideable Sub OnButton2Click() 'base button2 click behaviour End Sub derived form: Overrides Sub OnButton2Click() 'maybe: MyBase.OnButton2Click 'derived button2 click behaviour End Sub -- Larry Lard Replies to group please
Collections challenge (MRU)
Retrieve data from xml document Determining the Browser and event.keyCode vs. event.which difference between ME and MYCLASS Createing the Domain searce dialog Changing the checked state of Dynamically added checkboxes hair cross cursor advice needed for a good book to make good database applications How select from 2 ADO.NET DataTables? Retainig location in autopostback |
|||||||||||||||||||||||