473,396 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Handles vs. Overrides

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

Dec 21 '05 #1
3 1821
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.

--
Best Regards

The Inimitable Mr Newbie º¿º
"YYZ" <ma********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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

Dec 21 '05 #2
"YYZ" <ma********@gmail.com> schrieb:
I have a usercontrol that I want to paint myself. What is the
difference between these 2 methods of handling the painting?
[Handling an event or overrinding 'On*']


To Override Or To Handle?
<URL:http://www.bobpowell.net/overrideorhandle.htm>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 21 '05 #3
YYZ
> > I have a usercontrol that I want to paint myself. What is the
difference between these 2 methods of handling the painting?
[Handling an event or overrinding 'On*']


To Override Or To Handle?
<URL:http://www.bobpowell.net/overrideorhandle.htm>


And that explains it perfectly. Thanks so much!

Matt

Dec 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ECVerify.com | last post by:
I posted this earlier but never got a response...so I am trying again **************************** Hey everyone, I have a simple (I hope question) To get the events in C# I can go to the...
4
by: Christopher W. Douglas | last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows me to create a class with two or more methods that have the same name, as long as they have different (non-optional)...
2
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
9
by: Surrealist | last post by:
I need something likes as when I create an event procedure. I can use top-left and top-right dropdown list of code editor to select object and its exposed events respectively. Then, the IDE,...
10
by: Atif | last post by:
Hi I am here to solve a small confusion i have in "Overloads Overrides". "Overloading" says that the method's name should be same while no. of parameters and/or their datatypes should be changed...
2
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to...
9
by: raylopez99 | last post by:
microsoft.public.dotnet.languages.vc Please comment on the following code fragment. Note the comments "Why"? Particularly, (1) why does referencing and dereferencing a pointer give the same...
12
by: André | last post by:
Hi, i'm learning working with classes. In class "classbase1", i defined an overridable function. In the class "subclass1", i defined the same function with 'Overrides'. In class "classbase2", i...
1
by: =?Utf-8?B?QnJldHRWUA==?= | last post by:
I have a child-class that inherits from a base class that implements an Interface. The child class overrides a SUB from the base class that implements a sub from the interface. (The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.