Can I add another code file to a Windows Forms Form so that it appears below the form in the Solution Explorer?
- MyWindow.cv
- MyWindow.designer.cs
- MyWindow.cs
- MyWindow.Helpers.cs
If I just add another file with this name, it isn’t files below MyWindow. Moreover, it is displayed with a Form icon. My code file has grown huge, that is why I’d like to split it up.
Cheers
Matthias
The correct solution would be to extract helper classes.
But you can simply add a new class file (not a new windows forms file) and save your project. Open the csproj file in a text editor and locate the
<Compile Include="yourNewFile.cs">tag of the newly added file.Inside this tag, add a new tag
<DependentUpon>YourParent.cs</DependentUpon>, whereYourParent.csis the file you want to put the new file under. Save the csproj file and switch back to VS and reload the project file.