473,324 Members | 2,268 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,324 software developers and data experts.

"ByVal sender As Object" hmmm, I've so much to learn....

I'll avoid tell you how lame I am and get straight to the question...

I need a good expanation to the "ByVal sender As Object, ByVal e As
System.EventArgs" part of;
Public Sub button01_click(ByVal sender As Object, ByVal e As
System.EventArgs)

I dont understand any of that part. ByVal? sender? e?
System.EventArgs? Do you know of any good references explaining what
this stuff is? I'm sure it's different for each routine, and I
obviously need to learn...

cheers and thanks

m
Nov 17 '05 #1
3 1882
First, ByVal and ByRef mean "by value" and "by reference". Since everything
you do on a computer is in memory, something things just want a "pointer" to
the memory location where you data is. Some want the actual data itself.
There are advantages to both.

A ByVal parameter makes a copy of the value, whereas ByRef passes the
pointer to the memory address. Therefore, if a parameter is passed ByRef and
you change it's value in your function, it changes for the caller too -
because you were both pointing at the same memory location.

If a parameter is passed in ByVal, then you have a copy of it. If you make
changes inside your function, then it leaves the orginal alone - because you
have a seperate copy.

"sender" is a generic reference to which object kicked off the event that
you are in. You may just want to know, who fired the event. "EventArgs" are
arguments that go along with that event. Those both become more meaningful
when you use an object like a treeview - where the sender is the node that
was clicked, etc..

hth

"Maurice Walmsley" <mb********@hotmail.com> wrote in message
news:92**************************@posting.google.c om...
I'll avoid tell you how lame I am and get straight to the question...

I need a good expanation to the "ByVal sender As Object, ByVal e As
System.EventArgs" part of;
Public Sub button01_click(ByVal sender As Object, ByVal e As
System.EventArgs)

I dont understand any of that part. ByVal? sender? e?
System.EventArgs? Do you know of any good references explaining what
this stuff is? I'm sure it's different for each routine, and I
obviously need to learn...

cheers and thanks

m

Nov 17 '05 #2
Is Object always passed by reference?

"Frank Drebin" <no*****@imsickofspam.com> wrote in message
news:Qe**********************@newssvr28.news.prodi gy.com...
First, ByVal and ByRef mean "by value" and "by reference". Since everything you do on a computer is in memory, something things just want a "pointer" to the memory location where you data is. Some want the actual data itself.
There are advantages to both.

A ByVal parameter makes a copy of the value, whereas ByRef passes the
pointer to the memory address. Therefore, if a parameter is passed ByRef and you change it's value in your function, it changes for the caller too -
because you were both pointing at the same memory location.

If a parameter is passed in ByVal, then you have a copy of it. If you make
changes inside your function, then it leaves the orginal alone - because you have a seperate copy.

"sender" is a generic reference to which object kicked off the event that
you are in. You may just want to know, who fired the event. "EventArgs" are arguments that go along with that event. Those both become more meaningful
when you use an object like a treeview - where the sender is the node that
was clicked, etc..

hth

"Maurice Walmsley" <mb********@hotmail.com> wrote in message
news:92**************************@posting.google.c om...
I'll avoid tell you how lame I am and get straight to the question...

I need a good expanation to the "ByVal sender As Object, ByVal e As
System.EventArgs" part of;
Public Sub button01_click(ByVal sender As Object, ByVal e As
System.EventArgs)

I dont understand any of that part. ByVal? sender? e?
System.EventArgs? Do you know of any good references explaining what
this stuff is? I'm sure it's different for each routine, and I
obviously need to learn...

cheers and thanks

m


Nov 17 '05 #3
Say what!

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:em****************@TK2MSFTNGP10.phx.gbl...
Is Object always passed by reference?
Yes, but there are still times when you may need to pass an Object ByRef.
For example, if you need to re-assign the Object, you have to pass it

ByRef. If you only need to change a property, passing it ByVal will work.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"JohnG" <JG******@rogers.com> wrote in message
news:YG*********************@news01.bloor.is.net.c able.rogers.com...
Is Object always passed by reference?

"Frank Drebin" <no*****@imsickofspam.com> wrote in message
news:Qe**********************@newssvr28.news.prodi gy.com...
First, ByVal and ByRef mean "by value" and "by reference". Since

everything
you do on a computer is in memory, something things just want a "pointer"
to
the memory location where you data is. Some want the actual data itself. There are advantages to both.

A ByVal parameter makes a copy of the value, whereas ByRef passes the
pointer to the memory address. Therefore, if a parameter is passed ByRef
and
you change it's value in your function, it changes for the caller
too - because you were both pointing at the same memory location.

If a parameter is passed in ByVal, then you have a copy of it. If you

make changes inside your function, then it leaves the orginal alone - because you
have a seperate copy.

"sender" is a generic reference to which object kicked off the event that you are in. You may just want to know, who fired the event.
"EventArgs"
are
arguments that go along with that event. Those both become more

meaningful when you use an object like a treeview - where the sender is the node that was clicked, etc..

hth

"Maurice Walmsley" <mb********@hotmail.com> wrote in message
news:92**************************@posting.google.c om...
> I'll avoid tell you how lame I am and get straight to the

question... >
> I need a good expanation to the "ByVal sender As Object, ByVal e As
> System.EventArgs" part of;
> Public Sub button01_click(ByVal sender As Object, ByVal e As
> System.EventArgs)
>
> I dont understand any of that part. ByVal? sender? e?
> System.EventArgs? Do you know of any good references explaining what
> this stuff is? I'm sure it's different for each routine, and I
> obviously need to learn...
>
> cheers and thanks
>
> m



Nov 17 '05 #4

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

Similar topics

7
by: Ryan Park | last post by:
Hi, //SITUATION I got a panel control that hold a certain position on a form. Every controls or UIs are on this panel. At certain situation, I called dispose() method of this panel control...
11
by: Florian Loitsch | last post by:
I'm currently writing a JS->Scheme compiler (which, using Bigloo, automatically yields a JS->C, JS->JVM, JS->.NET compiler), and have a question concerning the function-parameters: According to...
0
by: Sin | last post by:
Hello, I'm currently toying around with using a VB.NET interface in a VC.NET program and I've come across somewhat of a problem. I found a workaround but I figure I must be a bit off cause it...
7
by: Clint Herron | last post by:
Howdy! I posted this question on CSharpCorner.com, but then realized I should probably post it on a more active newsgroup. This will be my only cross-post. I'm creating a game engine, and...
3
by: Alan LeHun | last post by:
I want to attach a context menu to multiple textboxes but I don't know how the extract the name of the textbox that is the subject of the event. I can't seem to do anything with "sender as...
33
by: Frederick Gotham | last post by:
(My dialect of English seems to puzzle people at times, so I'll first clarify a few terms which I use in the following post:) (1) By "domestic", I mean "ordinary, run-of-the-mill, not...
4
by: Spectre1337 | last post by:
Hello, to my understanding the ASP.NET process works as follows: 1) Page_Init(): At this moment the user should allocate his controls, set their IDs and connect them to the page...
4
by: Rob | last post by:
I see that MsgBox(sender.ToString()) will return a string that includes the Text value of a button... Is there a way to return only the Text value (i.e., some additional property designate) ?
4
by: My Pet Programmer | last post by:
Ok guys, I'm really looking for someone to tell me how bad a hack this is, and if I'm close to where I should be with it. The basic situation is that I have a class which creates a basic...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.