skip to Main Content

In c# projects I often add several menu items or buttons to a form then I switch the property panel to Events then start double clicking in the proper event handler method "box" to add the default event handler method name to each of the items.

The problem is Visual Studio always switches to the code window when new event handlers are added!

Many controls have 2 or events that typically get added such as ListView ColumnClick and SelectedItemChanged.

I have to continuously switch back to the Forms designer which is sometimes difficult because I often have more forms and code windows open to see of all filenames and have to fish out the current form I am working on.

I’ve searched the world wide web over looking for this option to no avail. I would not be surprised at all if someone labels my post as potential duplicate because this annoying behavior has pestered me for years!

2

Answers


  1. As jmcilhinney said, you can use shitf+f7 (Right click -> View Designer )to switch from the code view to the design view in the editor.

    Login or Signup to reply.
    • Open your form visual designer
    • Double click your first button, the code view appears
    • Drag the code view’s tab out of visual studio’s tab bar and place the code window side by side with VS – you can press Windows + Cursor_Left (or right) to make it sticky occupy half your monitor or if you have two monitors you can put it on your other screen
    • Take your mouse back to the visual designer now visible again in VS’ other window
    • Double click all your other buttons etc – you’ll see the code appear in the code view but it doesn’t disrupt your workflow now; you can double click one button after another, bam bam bam, and see the event handlers appear but the visual designer remains visible
    • When you’re done you can drag the code view back into the tab bar or just close it (it will reappear in the dock when it reopens)

    enter image description here

    Here’s what it should look like for you, whether you’re double clicking things to insert the default event, or using the grid to pick other events:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search