Handles vs. Overrides

Y

YYZ

I have a usercontrol that I want to paint myself. What is the
difference between these 2 methods of handling the painting?

Private Sub ucLoanDisplay_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles MyBase.Paint

vs.

Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)

I think I'm missing something big here in understanding .Net.

Thanks!

Matt
 
M

Mr Newbie

Handles is used to tell .NET that you want this sub to handle a particular
event, in your case the Paint event.

Overrides in this case replaces the default functionality of the Paint event
for the control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top