CSharp and VB.NET object, event browser differences in UI

  • Thread starter Thread starter Alex Sheppard-Godwin
  • Start date Start date
A

Alex Sheppard-Godwin

In VS when your working on a VB code module for a web form you can see a
list of object in the left hand drop down list above the code window and
possible events in the right hand drop down list.
In C# you only see the class name, so getting a code template for an event
is more difficult.

Is this just a difference between the two languages or is there something
I'm missing?

Cheers

Alex
 
Alex Sheppard-Godwin said:
In VS when your working on a VB code module for a web form you can see a
list of object in the left hand drop down list above the code window and
possible events in the right hand drop down list.
In C# you only see the class name, so getting a code template for an event
is more difficult.

Is this just a difference between the two languages or is there something
I'm missing?

No, there is definately a difference.

In C#, if you want to stub out an event, type:

something.SomeEvent += [TAB][TAB]

This will create the event handler delegate declaration
and it will create the stub method for you.

After you type the +=, a pop-up Intellisense window
will appear telling you to press tab for the auto
declaration. You probably didn't pay attention to
it since a window similar to it, but without the
TAB key auto-stubbing used to appear in VS.NET 2002.

I had to have someone point it out to me too, so
don't feel bad you missed it :)

Likewise, when you declare your class and say
that you're implementing and interface, it will
pop-up and tell you to hit TAB to stub out all
the interface methods. I'm not sure how that works
for abstract base classes. It may work too, but
I haven't tried it recently.

-c
 
Also, in the designer, if you go to the window that has properties and click
on the yellow lightening bolt, you'll see a list of events for the selected
control/form. Double click on a blank event and it will create the stub for
the event for you.

--
Mike Mayer
http://www.mag37.com/csharp/
(e-mail address removed)


Chad Myers said:
Alex Sheppard-Godwin said:
In VS when your working on a VB code module for a web form you can see a
list of object in the left hand drop down list above the code window and
possible events in the right hand drop down list.
In C# you only see the class name, so getting a code template for an event
is more difficult.

Is this just a difference between the two languages or is there something
I'm missing?

No, there is definately a difference.

In C#, if you want to stub out an event, type:

something.SomeEvent += [TAB][TAB]

This will create the event handler delegate declaration
and it will create the stub method for you.

After you type the +=, a pop-up Intellisense window
will appear telling you to press tab for the auto
declaration. You probably didn't pay attention to
it since a window similar to it, but without the
TAB key auto-stubbing used to appear in VS.NET 2002.

I had to have someone point it out to me too, so
don't feel bad you missed it :)

Likewise, when you declare your class and say
that you're implementing and interface, it will
pop-up and tell you to hit TAB to stub out all
the interface methods. I'm not sure how that works
for abstract base classes. It may work too, but
I haven't tried it recently.

-c
 
Back
Top