Partial Classes andSolution explorer
-
Hello every one. I have a Vb 2005 express application and i am using partial classes. The application works fine. I had a observation that in the solution explorer the partial class is shown as a new form and there is no designer and resx file. When i double click the partial class file it shows a blank form. What i was assuming that it should come under the class for which i have declared it as partial class and not as a independent form Diagrammatically what the solution explorer has
+ -- frmMain.vb . |-- frmMain.Designer.vb . |-- frmMain.resx ---- frmMainPartial.vb
What i was expecting was+ -- frmMain.vb . |-- frmMain.Designer.vb . |-- frmMain.resx . |-- frmMainPartial.vb
I am concern that had i implemented the partial class the right way and the solution explorer is showing the right thing or i am wrong at some place Regards Nishkarsh -
Hello every one. I have a Vb 2005 express application and i am using partial classes. The application works fine. I had a observation that in the solution explorer the partial class is shown as a new form and there is no designer and resx file. When i double click the partial class file it shows a blank form. What i was assuming that it should come under the class for which i have declared it as partial class and not as a independent form Diagrammatically what the solution explorer has
+ -- frmMain.vb . |-- frmMain.Designer.vb . |-- frmMain.resx ---- frmMainPartial.vb
What i was expecting was+ -- frmMain.vb . |-- frmMain.Designer.vb . |-- frmMain.resx . |-- frmMainPartial.vb
I am concern that had i implemented the partial class the right way and the solution explorer is showing the right thing or i am wrong at some place Regards NishkarshThe solution-explorer doesn't group the files by the namespace or classes that are declared therein. The grouping can't be changed from the IDE as far as I know, but you can edit the Project file manually (or create a cool tool to do so). Here are the steps to get the Solution Explorer to display it your way; * Locate the projectfile (*.vbproj) and open in using notepad. * Find the line that links the file with the partial class to the project. It probably called "frmMainPartial";
<Compile Include="frmMainPartial.vb" />
* Now change it so it looks similar to the entry for the resource-file. It should become something like this;
<Compile Include="Class1.vb">
<DependentUpon>Form1.vb
</Compile>Or, using your formnames;
<Compile Include="frmMainPartial.vb">
<DependentUpon>frmMain.vb</DependentUpon>
</Compile>Enjoy :)
I are troll :)