VS.Net Dropdowns for objects and Events

T

Tina

Again, I'm a VB.Net Developer learining C# and I have another question...

(BTW, my questions on this forum, thus far, have been "newbie" questions but
no one seems to be able to answer any of them)

With VB.net when the codebehind file is being edited there are two dropdowns
at the top. the Left one has a list of all of the objects on the Page. The
right one has all of the events that exist for the object selected in the
left dropdown. That's what I use to write code to respond to events.

But in C#, the only thing is the left dropdown is ProjectName.PageName. the
right dropdown has the objects on the page. There is no dropdown that has
the events listed.

What goes? Is this the way it is supposed to behave?

Thanks,
T
 
M

Mythran

Tina said:
Again, I'm a VB.Net Developer learining C# and I have another question...

(BTW, my questions on this forum, thus far, have been "newbie" questions
but no one seems to be able to answer any of them)

With VB.net when the codebehind file is being edited there are two
dropdowns at the top. the Left one has a list of all of the objects on
the Page. The right one has all of the events that exist for the object
selected in the left dropdown. That's what I use to write code to respond
to events.

But in C#, the only thing is the left dropdown is ProjectName.PageName.
the right dropdown has the objects on the page. There is no dropdown that
has the events listed.

What goes? Is this the way it is supposed to behave?

Thanks,
T

Yes, this is how it is supposed to behave. If you want to see a list of
events, via the designer, open the form in design view and then open the
property window for the object you want to add the event handler for. Then,
click on the little lightning bolt on the property window (should be at the
top of the property window). This switches to an the listing of available
events to attach to :) Double-click on one of the events to add the
objectName.<eventHere> += new blah(...) code as well as the templated event
handler for that event :)

HTH,
Mythran
 
T

Tina

Well, correct you are. (So much for no one on this forum being able to
answer simple questions.)

Seems like this is a difference between c# and vb that there didn't need
exist. wonder why it's that way.

Thanks for your help.
T
 
M

Mythran

Tina said:
Well, correct you are. (So much for no one on this forum being able to
answer simple questions.)

Seems like this is a difference between c# and vb that there didn't need
exist. wonder why it's that way.

Thanks for your help.
T

Well, the difference isn't in C# and VB.Net, it's in the MS.Net IDE :)

Mythran
 
M

Mythran

Tina said:
So, how do I call out the Page_PreRender event - for instance?
T

What I would do, is instead of using an event handler for any page events, I
would override the method that raises the event. So, instead of
Page_PreRender, I would override the OnPreRender method, and call the base
prerender method prior to the rest of my code.

So,

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
... yer code here ...
}

HTH,
Mythran
 

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

Similar Threads

Selecting events 1
C# IDE question, adding events 3
Various newbie questions on C# 7
Implementing DataGrid Events 2
Page Class Events 1
ASP.NET, Events, and C# 3
PropertyGrid question 3
NEWBIE QUESTION 1

Top