what is EventArgs

Y

Yangtsi River

Hi,
in any event procudure,there is two paras:sender As Object, e As EventArgs,
i copied them-not know what they are about, and my ASPX works.

I guess the sender is the control by which I triggered this sub, and what is
EventArgs then?

I am passing a third para to the sub, that is mysub("jim",sender As Object,
e As EventArgs),
the sub is defined like :
mysub(ByVal Nickname as string,sender As Object, e As EventArgs)
if nickname="jim" then
sdfsdfsd
end if
end sub
but when I call mysub("jim",sender As Object, e As EventArgs),, it said I
provided nothing about eventargs.
when I call mysub("jim"), it doesn't work too.

THe sub is a event sub, triggered by a clicking a button.

Can any one give me a hit ?

Thanx
Yangtsi River
 
N

Natty Gur

Hi,

EventArgs is a base type for classes that contain event data. One should
use this class to indicate that the current event isn’t containing any
event data.

by the way, what are trying to do ? Why do you create functions that
receive events arguments ?

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 
P

Prasad

Hi

When an Event is raised we need to which object [Control] is raised the
event. It is specified by the sender and sometimes the Event raising object
has to pass some values to the code which is handling event those values are
passed in the EventArgs.

eg. Assume We are moving the mouse in the form. The Event raised in
MouseMove. In the MouseMove event handling code the sender is the Form and
we also need to what is the X,Y position of the mouse which is obtained from
MouseEventArgs argument.

HTH
Prasad
 
K

Kevin Spencer

First of all, writing a server-side event handler to handle mouse movements
is going to initialte a PostBack from the client every time the mouse moves
one pixel in the browser. It's best to write client-side JavaScript event
handlers for that sort of thing. As for server-side event handlers for
controls that contain data in them, it's really a simple matter of writing a
custom Server Control that inherits the base class and provides its own
custom Event arguments class that inherits EventArgs and extends it with the
properties you need to contain the data.

--
HTH,

Kevin Spencer
..Net Developer
Microsoft MVP
http://www.takempis.com
Big things are made up
of lots of little things

Prasad said:
Hi

When an Event is raised we need to which object [Control] is raised the
event. It is specified by the sender and sometimes the Event raising object
has to pass some values to the code which is handling event those values are
passed in the EventArgs.

eg. Assume We are moving the mouse in the form. The Event raised in
MouseMove. In the MouseMove event handling code the sender is the Form and
we also need to what is the X,Y position of the mouse which is obtained from
MouseEventArgs argument.

HTH
Prasad

Yangtsi River said:
Hi,
in any event procudure,there is two paras:sender As Object, e As EventArgs,
i copied them-not know what they are about, and my ASPX works.

I guess the sender is the control by which I triggered this sub, and
what
is
EventArgs then?

I am passing a third para to the sub, that is mysub("jim",sender As Object,
e As EventArgs),
the sub is defined like :
mysub(ByVal Nickname as string,sender As Object, e As EventArgs)
if nickname="jim" then
sdfsdfsd
end if
end sub
but when I call mysub("jim",sender As Object, e As EventArgs),, it said I
provided nothing about eventargs.
when I call mysub("jim"), it doesn't work too.

THe sub is a event sub, triggered by a clicking a button.

Can any one give me a hit ?

Thanx
Yangtsi River
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top