How to open code on double cick on form by default?
Asked Answered
C

6

27

Is there an extension for Visual Studio 2010 for opening code for forms, components etc. in WinForms application projects on double click in solution explorer by default (and in designer view via context menu)?

Cornucopia answered 12/8, 2011 at 9:6 Comment(0)
T
47

item -> right click -> Open With -> Source Code (Text) Editor -> press Set as Default button

Terza answered 12/8, 2011 at 9:11 Comment(1)
The specific option is "CSharp Editor". I assume it is "Visual Basic Editor" and "C++ Editor" for those respective languages, as well.Blastocyst
D
15

you can set visual studio's default editor to be the code view rather than the form view. Just right-click and choose Open With... then you can set the default in there.

Delastre answered 12/8, 2011 at 9:11 Comment(0)
J
1

You can press F7 to toggle between designer and code.

Jellyfish answered 12/8, 2011 at 9:16 Comment(0)
P
0

Not sure about double click, but if you select the file in Project Explorer (ex: Form1.cs) and press F7 you see the code.

Poona answered 12/8, 2011 at 9:17 Comment(0)
H
0

If you want Visual Studio to avoid opening designer for Forms or Controls, just decorate your class with DesignerCategoryAttribute

[DesignerCategory("")]

If for some reasons you want opposite behavior and you want to force opening your class in designer by default, which might be caused when you have more than one class inheriting from Form in the same file, just specify category.

[DesignerCategory("Form")]
Heuer answered 28/4, 2020 at 22:41 Comment(0)
T
0

Just go to "Tools > Options > Web Forms Design" and select Start Pages in Source View.

Tourneur answered 3/4, 2021 at 14:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.