Y
Yuanxi Liu
Hi, everyone. I get a very interesting thing in VB.net
2003.
First you create a base form, and then add a button in
the baseform. Write an overridable function to fire a
event when the buton is clicked. I just write the
following code:
Overridable sub btnOK_Click(...) handles btnOK.click
me.close
End sub
Second you create a new form. inherit it from the base
form. Make a new override function about the button OK. I
just write down:
Overrides sub btnOK_Click(...) handles btnOK.click
msgbox("Oh, no",...)
End sub
Finally you run this project, and click the button in the
child form. You will find the msgbox pops out twice, which
means the override function executes twice!
..
2003.
First you create a base form, and then add a button in
the baseform. Write an overridable function to fire a
event when the buton is clicked. I just write the
following code:
Overridable sub btnOK_Click(...) handles btnOK.click
me.close
End sub
Second you create a new form. inherit it from the base
form. Make a new override function about the button OK. I
just write down:
Overrides sub btnOK_Click(...) handles btnOK.click
msgbox("Oh, no",...)
End sub
Finally you run this project, and click the button in the
child form. You will find the msgbox pops out twice, which
means the override function executes twice!
..