473,461 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why use AddHandler?

What is the reason for using AddHandler as opposed to simply writing the
needed code in the event you are adding a handler to?
Dec 10 '05 #1
7 2814

"Jim Hubbard" <Ji*@notmyaddress.com> wrote in message
news:Ry***************@bignews7.bellsouth.net...
What is the reason for using AddHandler as opposed to simply writing the
needed code in the event you are adding a handler to?


I assume you mean the VB Handles clause?

Anyway, AddHandler should let you use methods that aren't in classes you
write or delegates that were returned from a class library.
Dec 11 '05 #2
You mean the ability to hook into those methods as a trigger for some code
that I would like to run when that method (event) happens?
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:uv**************@TK2MSFTNGP14.phx.gbl...

"Jim Hubbard" <Ji*@notmyaddress.com> wrote in message
news:Ry***************@bignews7.bellsouth.net...
What is the reason for using AddHandler as opposed to simply writing the
needed code in the event you are adding a handler to?


I assume you mean the VB Handles clause?

Anyway, AddHandler should let you use methods that aren't in classes you
write or delegates that were returned from a class library.

Dec 11 '05 #3
Jim,

You can use addhandler in any place, however in some places you need them.
By instance,

1*
In a loop if you want to add the events of many controls to one method

2*
Inside an method than handles an event. Think by instance on the recursive
way of acting if you change an index inside an index change event, than you
can do as first instruction.

Removehandler blabla, addressof blabla
..
..
and as last in that method
AddHandler blabla, addressof blabla

3*
With dynamic controls (otherwise you have to declare them first global).

I hope that this gives an idea

Cor
"Jim Hubbard" <Ji*@notmyaddress.com> schreef in bericht
news:Ry***************@bignews7.bellsouth.net...
What is the reason for using AddHandler as opposed to simply writing the
needed code in the event you are adding a handler to?

Dec 11 '05 #4

"Jim Hubbard" <Ji*@notmyaddress.com> wrote in message
news:1x****************@bignews5.bellsouth.net...
You mean the ability to hook into those methods as a trigger for some code
that I would like to run when that method (event) happens?

I mean you could use it if you wanted to hook a method on an outside class
up to an event.
Dec 14 '05 #5
Jim
I wanted to override a webbrowser function.

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:OB*************@TK2MSFTNGP15.phx.gbl...

"Jim Hubbard" <Ji*@notmyaddress.com> wrote in message
news:1x****************@bignews5.bellsouth.net...
You mean the ability to hook into those methods as a trigger for some
code that I would like to run when that method (event) happens?

I mean you could use it if you wanted to hook a method on an outside class
up to an event.

Dec 14 '05 #6

"Jim" <re***@groups.please> wrote in message
news:%5*******************@bignews4.bellsouth.net. ..
I wanted to override a webbrowser function.


I don't understand waht you mean.
Dec 14 '05 #7
Jim
I think I figured it out. Thanks for the help though.

What I have not figured out is how to expose interfaces that are not exposed
via the webbrowser control......like how to control what is downloaded on a
per-webbrowser instance. The details seem to be at
http://msdn.microsoft.com/library/de...ebbrowser2.asp ,
but they make very little sense to me - being ignorant of c/c++.

Is there a way to do this in VB.Net?

As long as I'm asking for world peace and honest politicians......I also
need to know how to implement the IInternetSecurity interface (bottom of
same page in link above) and how to override context menus in
VB.Net..........basically everything you see on the page linked to above.

I'd really like just a single example and to learn how to do this stuff
myself rather than have it all just handed to me, but I have no idea (or
examples) to give me a push in the right direction.

If you know of any, I'd surely be grateful.

Thanks!

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:OO**************@TK2MSFTNGP14.phx.gbl...

"Jim" <re***@groups.please> wrote in message
news:%5*******************@bignews4.bellsouth.net. ..
I wanted to override a webbrowser function.


I don't understand waht you mean.

Dec 15 '05 #8

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

Similar topics

7
by: UGH | last post by:
I am adding image buttons dynamically and I need to add event handler when the user clicks on one of those image buttons which will have different id for reports. Here is my code LnkImage =...
1
by: Luis Esteban Valencia Muñoz | last post by:
Have a dropdownlist created in my LoadMain() which is called from the Page_load: ************************PAGE LOAD********************8Private Sub Page_Load(ByVal sender As System.Object, ByVal e...
4
by: DJ | last post by:
Good morning, Still new at this so please bear with me. I am creating a table dynamically using webcontrols based on the output of a sproc from my database.The table represents test instances...
2
by: Just Me | last post by:
When a document is to be printed I call a method that contains an AddHandler statement. I just realized that if a second copy is to be printed the method is called and the AddHandler is executed...
10
by: Rick Palmer | last post by:
I have an app I'm working on that will allow a user to run one of 5 reports. The report names are in a combobox on my form. I have a sub defined for each report that has the exact same name as is...
5
by: eBob.com | last post by:
I've used AddHandler for a UNIQUE control added to a panel and it seemed to work. But now I want to add a bunch of controls to a panel and use only one event handler subroutine. And I am...
3
by: hartley_aaron | last post by:
Hi, I was trying to store the address of the my current handler for a particular event so as to simplify using AddHandler and RemoveHandler throughout my code. However, I cannot seem to get any...
2
by: TrtnJohn | last post by:
If you call AddHandler and hook events of one object to a method in a class will the event source object still be available for garbage collection if the original reference is set to Nothing? Or...
2
by: Joe | last post by:
Hello All: Can I wire server control events in the page's PreRender event and have them take effect? I am rendering LinkButtons in a Table on a webform and am using AddHandler to wire each...
5
by: Slim | last post by:
i have a simple page, with one button button1. when click it creates a new button button 2 and adds a event handler to it. but when button 2 is clicked nothing happens, why? Partial Class...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.