Forum Moderators: open

Message Too Old, No Replies

Must Event Handler Use Object and EventArgs Parameters?

         

noxbane

3:42 am on Mar 4, 2004 (gmt 0)

10+ Year Member




Okay, say I got a subroutine called DisplayLocation. What it does is change the text of a

label to display a certain image. Which image it displays depends on the parameter passed

to it. But i want the event that calls the DisplayLocation subroutine to be a button. But

it seems that using events, the event handler has to accept the parameters Object and

EventArgs. But what if i want my button click to call a subroutine where i send in my own

parameters? Like if i want to call DisplayLocation('image1'). How do i do that with a

button click?

BTW, dont concentrate too much on the specifics of the problem about changing images in a

label. Thats just an example. I just want to know how to send my own parameters to a

subroutine/function thats called by something like a button click.

raywood

3:35 pm on Mar 4, 2004 (gmt 0)

10+ Year Member



Just add another parameter. Leave the Object and Event Args in the call and add something like imgLoc as String. It works for me.
ray