Using VS2013 it was possible, at least with VB.NET, to double click on a control and then the default event would show up in the code file. Above this there was a pull down list of the other possible events for this control.
Now I'm working in VS2015 and in C#, but that list is not there. I can still double click on a control to get the default event, but I cannot add another event. I don't think I'm supposed to edit the designer file.
How do I do this now? Do I need to add events in the code file now?
for example I want to be able to drop a file on my windows application. So somewhere I need to add the event for this.
Select Alt+F2 to open the Performance Profiler in Visual Studio. Select the Events Viewer check box. Select the Start button to run the tool. After the tool starts running, go through the scenario to profile in your app.
An event is a signal that informs an application that something important has occurred. For example, when a user clicks a control on a form, the form can raise a Click event and call a procedure that handles the event.
Winforms :
Wpf:
To see the properties window:
Using VS2013 it was possible, at least with VB.NET, to double click on a control and then the default event would show up in the code file. Above this there was a pull down list of the other possible events for this control.
This is known as the Navigation Bar. You can toggle it on/off in Tools --> Options --> Text Editor --> {Select Language} --> Navigation Bar.
BUT...the Navigation Bar behaves differently in C# than it does in VB.Net. It won't do what you want in C#, sorry!
To wire up an event using the IDE in C#, you have to first select the thing in question, then go to the Properties Pane and switch it to the Events view with the "Lightning Bolt" icon as Empereur Aiman has shown in his post.
C#, however, can do something that VB.Net cannot. With C#, you can wire up an event by writing a line of code in the editor and have the IDE generate the event stub for you. For instance, in the snippet below, a dynamic button is being created:
Button btn = new Button();
If you want to wire up its Click() event, you'd type in:
btn.Click +=
After the equals sign =
is typed, you'd press {Tab} and the event stub will be generated for you:
private void Btn_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With