Click here to Skip to main content
15,745,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I running into a problem sinds we using visual studio 2015. I have a couple of old 2010 windows form application with the resx file inside the code file (.vb). This make the compiler very slow because of the extra (2000-7000) lines.

I want to get ride of Windows Form Designer generated code inside the .vb instead of designer file


<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      Me.OKButton = New System.Windows.Forms.Button
      Me.AppTitleLabel = New System.Windows.Forms.Label
      Me.GroupBox1 = New System.Windows.Forms.GroupBox
      Me.AppDescriptionLabel = New System.Windows.Forms.Label
      Me.AppVersionLabel = New System.Windows.Forms.Label
      Me.AppCopyrightLabel = New System.Windows.Forms.Label
      Me.SysInfoButton = New System.Windows.Forms.Button
      Me.AppDateLabel = New System.Windows.Forms.Label
      Me.ImagePictureBox = New System.Windows.Forms.PictureBox
      Me.DetailsButton = New System.Windows.Forms.Button

This code is for all 2010 application in the vb script file.
if i copy paste this in a seperated designer file its creating a new windows form designer. Does anyone have a solution to get this separated without (re)building a new design file (a tool or something)?

What I have tried:

Copy resx file by hand.
Searching on forum for solution.
Updated 31-Mar-17 2:40am
Graeme_Grant 31-Mar-17 4:10am    
Developers sacrifice and contribute their own time for free to help fellow developers resolve difficulties. It is important that you are crystal clear about what you are experiencing with plenty of information so that your time and theirs are not wasted. The clearer the question, the better chance that you will get a favorable response in a timely manner.

Please take the time to look at these links provided before posting questions:
* Some guidelines for posting questions in the forums[^]
* Tales from the Evil Empire - Asking questions is a skill[^]

Once you are ready update the question with clear and concise details, sample code, any error messages (including inner exception details), etc, please click on Improve question to add more info to the question.
Wessel Beulink 31-Mar-17 4:59am    
Ofcorse i'll include a example. Thnx, Hope this is better now? I unfortunately do not have any other errors or details it's more about a out-dated project.
CHill60 31-Mar-17 6:43am    
I would expect that code to be in a form's designer.vb file not resx file. If you delete the code then it is equivalent to removing the controls from the form.
If the compile takes a long time, then it takes a long time
Wessel Beulink 31-Mar-17 7:24am    
Sorry you are right I mean designer.vb and not the resx file. All my projects before vs 2013 are not separated in a script.vb and script.designer.vb
CHill60 31-Mar-17 7:48am    
In that case you most definitely do NOT want to remove that code - unless you really do want to remove the controls from the form. I've got VS2008 installed and it creates a Form1.vb AND a Form1.Designer.vb. How long is this compile taking anyway?

1 solution

Splitting a form into partial classes is the sort of thing you used to be able to do with a macro[^]. But unfortunately, macros were removed in VS2012.

There's an add-in for VS2012 on CodeProject - I'm not sure if it will work in VS2015:
A Visual Studio add-in to move Windows Forms Designer generated code from a .vb file to a .Designer.vb file[^]

There's also a stand-alone tool, which claims to support VS2010 projects:
DeCodEx | CoolSoft[^]

If neither of those work, you can always split the file manually:
visual studio - Split old .NET code into designer partial class - Stack Overflow[^]
Share this answer
Wessel Beulink 31-Mar-17 11:06am    
Going to try first solution. Should be convert able to a vsix extensions. Going to try. To CoolSoft tool isn't working.
Wessel Beulink 3-Apr-17 2:48am    
Changed the windows form designer generated code from a .vb file tool to a vsix project. Worked like a charm. Only problem with the custom controls so far, but that's gonna be oke.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900