2

I've recently started using C# after years of using VB.NET

When using Visual Studio, using VB.NET, on the code behind files (.aspx.vb) i could select from a list of controls in my markup file (.aspx) and then select an event to automatically put into my code behind.

I've noticed with C# I don't get this option:

enter image description here

Why is this? Or is my intellisense just playing up?

Curtis
  • 101,612
  • 66
  • 270
  • 352
  • 1
    http://stackoverflow.com/questions/1135299/microsoft-visual-studio-and-c-how-to-visually-add-events-to-controls – Damith Aug 21 '11 at 15:50

2 Answers2

3

In c# you can't add events like vb.net project, two dropdowns in C# project for class and its methods. you have to use property window to add events or double click on the controller it will add default event for the control.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Damith
  • 62,401
  • 13
  • 102
  • 153
2

If you are looking for a list of Events you will need to be on the form, not in code behind.

Select the Form right click, go to Properties, at the top of the Properties bar you will see a lightning bolt, click this and you will see all available events for that Form.

Jethro
  • 5,896
  • 3
  • 23
  • 24
  • Is there no way of doing this from code behind rather than having to go to designer? – Curtis Aug 21 '11 at 15:53
  • You can do it in code but you have to know what the control's exposed events are first. All the designer does is make the process simpler. – Peter Bromberg Aug 21 '11 at 20:48