Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. partial classes in Solution explorer

partial classes in Solution explorer

Scheduled Pinned Locked Moved C#
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dino2094
    wrote on last edited by
    #1

    In solution explorer, I noticed that the Form1.Designer partial class is listed under the Form1.cs I created some other partial class(Myclass.cs) of From1 but it doesn't appear under the Form1 in solution explorer. Is there anyway I can get it to appear under Form1. Currently -Form1.cs | ----->Form1.Designer.cs | ----->Form1.resx ... ... MyClass.cs Looking for -Form1.cs | ----->Form1.Designer.cs | ----->Form1.resx | ----->MyClass.cs .....

    T E 2 Replies Last reply
    0
    • D dino2094

      In solution explorer, I noticed that the Form1.Designer partial class is listed under the Form1.cs I created some other partial class(Myclass.cs) of From1 but it doesn't appear under the Form1 in solution explorer. Is there anyway I can get it to appear under Form1. Currently -Form1.cs | ----->Form1.Designer.cs | ----->Form1.resx ... ... MyClass.cs Looking for -Form1.cs | ----->Form1.Designer.cs | ----->Form1.resx | ----->MyClass.cs .....

      T Offline
      T Offline
      ThaddParker
      wrote on last edited by
      #2

      Try prepending Form1 to MyClass.cs. The solution explorer tries to logically put everything together by their file name. If you write Form1.MyClass.cs, VS should see that file as a subset of your Form1 and show it in the tree as such.

      E 1 Reply Last reply
      0
      • D dino2094

        In solution explorer, I noticed that the Form1.Designer partial class is listed under the Form1.cs I created some other partial class(Myclass.cs) of From1 but it doesn't appear under the Form1 in solution explorer. Is there anyway I can get it to appear under Form1. Currently -Form1.cs | ----->Form1.Designer.cs | ----->Form1.resx ... ... MyClass.cs Looking for -Form1.cs | ----->Form1.Designer.cs | ----->Form1.resx | ----->MyClass.cs .....

        E Offline
        E Offline
        Ed Poore
        wrote on last edited by
        #3

        There's no way to do this automatically in VS but you can do this:

        1. Right click the project in the Solution Explorer and select Unload Project.
        2. Right click the project again in the Solution Explorer and select Edit Project.csproj
        3. Look for an XML element which is like <Compile Include="MyClass.cs" /> and change it to: <Compile Include="MyClass.cs"><DependentUpon>Form1.cs</DependentUpon></Compile>

        Close the project file in the editor and reload the project like in step 1, your file should now appear under the Form1 node.  Note you could specify Form1.Designer.cs and it'd be displayed under that one instead.

        T D 2 Replies Last reply
        0
        • T ThaddParker

          Try prepending Form1 to MyClass.cs. The solution explorer tries to logically put everything together by their file name. If you write Form1.MyClass.cs, VS should see that file as a subset of your Form1 and show it in the tree as such.

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          It doesn't do that automatically, see my response to dino2094.

          1 Reply Last reply
          0
          • E Ed Poore

            There's no way to do this automatically in VS but you can do this:

            1. Right click the project in the Solution Explorer and select Unload Project.
            2. Right click the project again in the Solution Explorer and select Edit Project.csproj
            3. Look for an XML element which is like <Compile Include="MyClass.cs" /> and change it to: <Compile Include="MyClass.cs"><DependentUpon>Form1.cs</DependentUpon></Compile>

            Close the project file in the editor and reload the project like in step 1, your file should now appear under the Form1 node.  Note you could specify Form1.Designer.cs and it'd be displayed under that one instead.

            T Offline
            T Offline
            ThaddParker
            wrote on last edited by
            #5

            I just saw myself after digging into the project file, when I couldn't repeat what I was talking about. Thank you for showing my ineptitude!

            1 Reply Last reply
            0
            • E Ed Poore

              There's no way to do this automatically in VS but you can do this:

              1. Right click the project in the Solution Explorer and select Unload Project.
              2. Right click the project again in the Solution Explorer and select Edit Project.csproj
              3. Look for an XML element which is like <Compile Include="MyClass.cs" /> and change it to: <Compile Include="MyClass.cs"><DependentUpon>Form1.cs</DependentUpon></Compile>

              Close the project file in the editor and reload the project like in step 1, your file should now appear under the Form1 node.  Note you could specify Form1.Designer.cs and it'd be displayed under that one instead.

              D Offline
              D Offline
              dino2094
              wrote on last edited by
              #6

              Mucho Gracias Senor!

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups