By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

Peculiar inconsistency in autogenerated event handler code

P: n/a

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
Share this Question
Share on Google+
5 Replies


P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.