Create partial class on upgraded code - vs2003-->vs2005 (extract windows form designer code)

Hi,

what is the best way to create a partial class to move all windows form designer code from the main class file (the way the 2005 IDE creates).

I have a number of forms that were converted from vs2003, and I want to go through and seperate the winform designer stuff out.

what are the gothcha's

thanks.

Lex.


Answer this question

Create partial class on upgraded code - vs2003-->vs2005 (extract windows form designer code)

  • Morten Meldal

    Right now, you have to do it by hand. (Use a newly generated product as an example.) It’s actually pretty easy – just add the new *.designer.vb file (where * is the name of the original file), create a partial class in there with the same name as that of the existing form, something like:



    _

    Partial Class Form1



    End Class



    And then cut all of the designer stuff from the original class file (including the Inherits System.Windows.Forms.Form statement, if you like) and paste it into the new partial. I’ve done this for several of my VS2003 projects, and it all went pretty quickly and easily.



    We’ve tossed around the idea of providing a way to do this automatically in future versions, but it’s kind of lower down on the priority list with respect to other features.



    --Matt--*

  • Timm2001

    thanks matthew, I will give it a try.

    .


  • JBailo

    I'm not sure how you'd tell the IDE to regenerate that code to a different file, but if you created partial classes using the same naming convention that VB2005 uses, perhaps it will just happen.



  • Create partial class on upgraded code - vs2003-->vs2005 (extract windows form designer code)