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

Peculiar inconsistency in autogenerated event handler code


Experiment A:
Start a new Windows Forms project. Double click Form1. This is what is
generated:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Experiment B:
Start a new Windows Forms project. Go to the code window for Form1.
Choose 'Form 1 events' from the left combo, then choose 'Load' from the
right combo. This is what is generated:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Note that in A, sender is 'System.Object', whereas in B it is 'Object'.
Weird, huh?

--
Larry Lard
Replies to group please

Feb 7 '06 #1
5 971
"Larry Lard" <la*******@hotmail.com> schrieb:
Experiment A:
Start a new Windows Forms project. Double click Form1. This is what is
generated:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Experiment B:
Start a new Windows Forms project. Go to the code window for Form1.
Choose 'Form 1 events' from the left combo, then choose 'Load' from the
right combo. This is what is generated:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Note that in A, sender is 'System.Object', whereas in B it is 'Object'.
Weird, huh?


Yep. Unfortunately automatically generated code is rather inconsistent in
its look. You may want to file a suggestion or bug report in MSDN Product
Feedback Center (<URL:http://lab.msdn.microsoft.com/productfeedback/>) and
post the URL to the report for voting here.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Feb 7 '06 #2
CMM
Looks like Microsoft didn't use good "encapsulation" practices even in their
own code. Sounds like two different (internal) functions are generating the
stub... when there's no reason it should be one.

Feb 7 '06 #3
CMM,
Looks like Microsoft didn't use good "encapsulation" practices even in
their own code. Sounds like two different (internal) functions are
generating the stub... when there's no reason it should be one.

Withouth knowing what it is about.

It is not Microsoft who does things like this, it are just developers like
you.

Keep that in mind when you write things like this.

They don't do that express, in the same way as you don't do that.

Cor
Feb 8 '06 #4
CMM
> They don't do that express, in the same way as you don't do that.

You mean they didn't do it on purpose? Well, likely not. I was just trying
to "conceive" why this very minor but curious bug occurs. That's all.

But, hey if it works it works right? Isn't that your motto? (screw
standards, consistency, needless superflous encapsulation, and all that
burdonsome stuff... 300 "" emptystrings in your code vs 1 String.Empty???
Eh, what does it matter? You like the way "" looks, right?). Years from now
if a bug occurs someone else will figure out the code in the same exact way
they can figure out your English sentences, right? (i.e. that sentence up
there you wrote in NO WAY AT ALL makes any sense in English.)
It is not Microsoft who does things like this, it are just developers like
you.


Are you trying to offend me? Just because you need to use use hungarian
notation and I don't (anymore)? :-)

Anywayz...
Feb 8 '06 #5
CMM,

Not all of that, I try to protect those Microsoft developers.

It can be that they made a mistake, that is not hilarious, what I did read a
little bit in your message.

I would only write it in that way, as it is sure that it is an official
behaviour of Microsoft.

Cor
Feb 8 '06 #6

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

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
6
by: vbMark | last post by:
If I have a control, for example a CheckedListBox, how do I add and event to code, for example that a box has been checked by the user? Thanks
3
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind...
8
by: Binny | last post by:
I have a DG with autogenerated columns. can i make a columns readonly like the data key column. when edititemindex is valid. Thanks
0
by: Luis Esteban Valencia | last post by:
Once a user clicks "add new row", a new row is created in my Datagrid. The datasource is huge so they have to scroll to the bottom of the page to edit the data in the new row. I have come across...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
9
by: Steve | last post by:
How I can remove an AutoGenerated column? I wnat to inlcude the primary key in the resultset for creating some custom LinkButtons, but I don't want it (the PK) displayed in the DataGrid. I tried...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.