vs.net c# and control events

D

dave

I have been using vb.net /asp.net for 2 years. I am
slowing switching over to c# and have 2 questions.

1.) Within vb.net I can go into asp.net project
properties and I can enter the imports once for the
project. Can I do this with a c# asp.net project? (or am
i forced to put using on each and every asp.net page?)

2.) Within vs.net with a vb.net project, while editing
the code behind file, i have 2 drop downs along the top
of the window, one for the controls that have been placed
on the page and the other one for events that can be
raised from the control. With a c# asp.net project I do
not see the control events drop down box. Where did it
go?

thank you very much
dave
 
D

dave

I also noticed that intellisense within the html code
editor is not working as it does with vb.net.

Is this true?
 
P

Peter van der Goes

dave said:
I have been using vb.net /asp.net for 2 years. I am
slowing switching over to c# and have 2 questions.

1.) Within vb.net I can go into asp.net project
properties and I can enter the imports once for the
project. Can I do this with a c# asp.net project? (or am
i forced to put using on each and every asp.net page?)

2.) Within vs.net with a vb.net project, while editing
the code behind file, i have 2 drop downs along the top
of the window, one for the controls that have been placed
on the page and the other one for events that can be
raised from the control. With a c# asp.net project I do
not see the control events drop down box. Where did it
go?

thank you very much
dave

Hello, Dave.
I can deal with the event list for you.
With the GUI designer displayed, select the control you want events for,
then look at the top of the Properties Window. There you'll find a button
with a yellow lightning bolt icon. Click that button and the Properties
Window will display a list of events associated with the control you
selected. Double-click on the event you wish to create a handler for, and
the shell will be generated in your code.
 
T

Tian Min Huang

Hello Dave,

Thanks for your post. I now share the following information with you:
enter the imports once for the project. Can I do this with a c# asp.net
project?

Unfortunately, there is not such equivalent for C# project. We have an add
reference to the corresponding assemblies, and then add "using" line in C#.
working as it does with vb.net. Is this true?

Based on my experience, the intellisense for HTML code editor in C# project
works properly. Please choose the menu "Tools" -> "Options", go to "Text
Editor" -> "HTML/XML" -> "HTML Specific" and make sure that the "Statement
Completion" are set properly.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Peter or others....

What you described worked however, I have become
acustomed to not using the designer.

Is there a way to see a list of events for the control
from the code view window? With vb.net all the events
are displayed in a drop down while in code view. (there
must be an equivalent in c#)

Help please.
Thank you
 
D

dave

I am surprised that you are required to use the using on
every page. (this seems like a pain compared to the
vb.net world)

Regarding the intellisense. Thank you

I am in transition between vb.net (2 years experience) to
c#
Some of the nice things of vb.net just are not their with
c#.
 
C

Cor

Hi,

It is also in C#, but a little bit hidden.
You have to go to the properties page in the designer and push on the Flash
in top.
Than you can choose an event
And then it comes visible in the code view also.
Cor
 
D

dave

Peter or others....

What you described worked however, I have become
accustomed to not using the designer.

Is there a way to see a list of (all) events for a
control from the code view window?

With vb.net all the events are displayed in a drop down
while in code view. (there must be an equivalent in c#)

Help please.
Thank you
 
T

Tian Min Huang

Hello Dave,
view window?
Unfortunately, we can only see a list of all events in the property page in
C#.

Please feel free to let me know if any further is needed.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
D

dave

Just to understand, you mean that the only way i can see
the list of events with c# is while in design view and
looking in the properties window?

If this is true, i do not like that.

thx
dave
 
J

Jeff B.

Just to understand, you mean that the only way i can see
the list of events with c# is while in design view and
looking in the properties window?

Not that it really helps, but you can also see a list of events via
Intellisense - i.e. when you type a period following an object's name (e.g.
treeViewList.) you can see all events for the object in the list that is
displayed (they're the ones with the lightning bolt next to them).
 
T

Tian Min Huang

Hello Dave,
events with c# is while in design view and looking in the properties window?

Almost. As suggested by Jeff that you can also see a list of events via
IntelliSense, however, it is not able to generate event handling code for
you as properties window does.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Top