|
It makes perfect sense that you CAN'T do it.
Look at the parameters for the event handler. The first one, sender , is n System.Object , which is essentially just a container for every type of object known. Just about EVERYTHING is a descendant of the System.Object class.
Note that the System.Object class doesn't have an Enabled property. If you just specified any old property or method, how would the compiler know how to call it?
For example, you can use the same event handler to handle multiple events for multiple controls. They don't ALL have to be buttons. You can have a mix of buttons, checkboxes, panels, ..., anything else all using the same Click event handler. You can also mix events. The same handler can handle multiple types of events, so long as every event signature (parameters) is the same.
Now, knowing this, how is the compiler supposed to know what kind of object to automagically cast the sender parameter to in order to call it's properties and methods?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok, thanks for the explanation.
|
|
|
|
|
The default way of sending parameters to a method is by value. For reference types this means that you send the reference by value.
Sending parameters by reference is only used when you want to change the variable used in the method call. For reference types this means that you want to change the reference variable, not just change members of the object.
You want to be able to access the members of the control that caused the event, but you certainly don't want to change the forms reference to the control. That would break the form.
---
b { font-weight: normal; }
|
|
|
|
|
I think I understand. When sender is sent ByVal Sender as System.Object what is being sent is a pointer to the system object?
|
|
|
|
|
Yes.
Well, actually it's a reference, but a reference is just a protected pointer.
If you would send the object by reference, you send a reference to the variable containing the reference to the object.
---
b { font-weight: normal; }
|
|
|
|
|
Stop it! You'll melt his brain!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Wait until we get to sending by reference a reference to a boxed struct containing an array of objects...
---
b { font-weight: normal; }
|
|
|
|
|
Ouch!! Now you're melting MY brain!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
I need some code for create a dinamic menu in VB2005 .NET, this code may get the list of items from SQLSERVER.
I've a code from this website, but the items isn't in order correctly.
Thanks.
|
|
|
|
|
Someone can help with this code pls???
|
|
|
|
|
When I create textboxes at runtime and place them in a panel the user can not paste a value into them but they can type. Is there a Setting I have to use to allow this?
Thanks
Joe
|
|
|
|
|
Hi - I am trying to connect to the basic report that is set by SQL2005 during install.
I keep getting this error message while trying to connect - this is using -
http://localhost/reports
Server Error in '/Reports' Application.
--------------------------------------------------------------------------------
Failed to map the path '/Reports/App_GlobalResources/'.
|
|
|
|
|
I am thinking I am loosing my mind here, this worked yesterday..
? now()
6/28/2006 9:14:06 AM
? My_endtime
6/28/2006 10:13:44 AM
? now() > g_endtime
True
any idea why or how to reliably check for a time expiration?
|
|
|
|
|
Are you sure you didn't mix up with your variables?
? My_endtime
? now() > g_endtime
Do you see the difference?
|
|
|
|
|
Oops, no just a typo, I did use the right variable names in the code...
|
|
|
|
|
can i print a CR like this:
-----------------------------------------------------------------
|header(0) |header(1) |header(2) |header(0) |header(1) |header(2)|
-----------------------------------------------------------------
| index(0) | index(1) | index(2) | index(0) | index(1) | index(2) |
| index(0) | index(1) | index(2) | index(0) | index(1) | index(2) |
| index(0) | index(1) | index(2) | index(0) | index(1) | index(2) |
| index(0) | index(1) | index(2) | index(0) | index(1) | index(2) |
| index(0) | index(1) | index(2) | index(0) | index(1) | index(2) |
------------------------------------------------------------------
Can I?!!!
Faris Madi
Nothing Comes Easy (N.C.E.)
-- modified at 8:21 Wednesday 28th June, 2006
|
|
|
|
|
Yes you can.
Open the report and Go to the Field Explorer in the Left side Panel and open ur tabel in Database Fields. Then just Click and drag the field on to the report it allows u to make multiple copies of the same field. But its not possible for keping two different data fields in a row, you have to go with 1 record after the other.
as
-----------------------------------------------------------------
| ID | Name |Salary | ID | Name |Salary |
-----------------------------------------------------------------
|1001 | xxxxxx | 10000 | 1001 | xxxxxxx | 10000 | -> Possible
|1001 | xxxxxx | 10000 | 1002 | yyyyyyy | 20000 | -> Not Possible
Jats
-- modified at 9:38 Wednesday 28th June, 2006
|
|
|
|
|
- i'm looking for the not possible.
anyway thankx for the tip Jats..
Faris Madi
Nothing Comes Easy (N.C.E.)
|
|
|
|
|
dear friend...
if i have a form in vb.net such as (A) and another application in c language such as (B) how can i control the application (B) from the buttons based on form (A) and i mean of control :
1-run application B
2-minimize and mazimize form B
3-close form B
4- the most thing is make the form A always active that mean you cant use the appliation B except throught the form (A)
thanx all
kilany
kilany
|
|
|
|
|
Is this a repost? I recall this having been answered.
Best,
Jun
|
|
|
|
|
hi there,
Is there any possible way in VB.Net to open a new port on my lost host where other lan computers can be connected? how can i do this?
thanks
|
|
|
|
|
Hello every one
How can i get the total number of pages printed through a VB6 code
??
\Can anybody help me
|
|
|
|
|
I am working on VB.NET Web forms
I need a control to display paragraphs
with bullets, text with different fonts, text allignment etc.,
(which looks like wordpad to edit text)
Thanks in Advance
|
|
|
|
|
I try to create a form with its cancelbutton (at the right-top corner) is removed or disable. So the form looks like just a frame without the cancel button; or if click the form cancelbutton, the form will does nothing.
Could anyone provide help?
Thanks
-- modified at 4:03 Wednesday 28th June, 2006
|
|
|
|
|
Set the property Form.ControlBox to false.
Or
to have it visible but disable the closing action you need to handle the form's closing event
Private Sub FormClosing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
End Sub
=o)
Alex
-- modified at 11:18 Thursday 29th June, 2006
|
|
|
|