Importing form GUI from another project

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ronny

    #1

    Importing form GUI from another project

    I need to import the Winform GUI from one project to another(with all the
    controls).
    Is there a simple way to copy&paste it or must I create every control by
    hand

    Regards
    Ronny


  • Jianwei Sun

    #2
    Re: Importing form GUI from another project

    Hello Ronny,
    I need to import the Winform GUI from one project to another(with all
    the
    controls).
    Is there a simple way to copy&paste it or must I create every control
    by
    hand
    Regards
    Ronny
    I think you can copy& paste, do you encounter any issues?

    Thanks,
    J.W.


    Comment

    • Peter Duniho

      #3
      Re: Importing form GUI from another project

      On Sun, 13 Jul 2008 06:37:42 -0700, Ronny <ronny@giron.co mwrote:
      I need to import the Winform GUI from one project to another(with all the
      controls).
      Is there a simple way to copy&paste it or must I create every control by
      hand
      As J.W. say, you should be able to just copy/paste. Have you tried that?

      That said, you may find that it makes more sense to factor the Form
      sub-class out into a separate assembly and then reference it from whatever
      projects you want to use it. You can use copy/paste in doing that as
      well, but you may find it easier to just create a new empty project, copy
      the source .cs files into the new project's directory (don't forget the
      Designer file(s)), and then use the "Add Existing Item..." command to add
      the source files to your empty project.

      If you simply share the Form as a separate assembly, then when you find
      and fix a bug while working on one project that uses it, you won't have to
      go back and make the same fix to the other project that uses it. :)

      Pete

      Comment

      • Andrei Varanovich [C# MVP]

        #4
        Re: Importing form GUI from another project

        Hello Ronny,

        Right click on the solution --Add--Existing project inside Visual Stuido.

        Or just compile you GUI project in dll and add the reference to it.

        Kind regards,
        Andrei Varanovich [C# MVP]
        I need to import the Winform GUI from one project to another(with all
        the
        controls).
        Is there a simple way to copy&paste it or must I create every control
        by
        hand
        Regards
        Ronny

        Comment

        • Ronny

          #5
          Re: Importing form GUI from another project

          Thanks,
          Please note
          1.the source project is an executable
          2. my current project is a dll clas library
          3. I can't simply add it to the project. I have to import its form and the
          form controls.

          Regards
          Ronny




          Comment

          • Peter Duniho

            #6
            Re: Importing form GUI from another project

            On Sun, 13 Jul 2008 22:41:40 -0700, Ronny <ronny@giron.co mwrote:
            Thanks,
            Please note
            1.the source project is an executable
            You can add references to .exe files.
            2. my current project is a dll clas library
            Even in DLL projects.
            3. I can't simply add it to the project. I have to import its form and
            the
            form controls.
            Adding a reference to any executable (DLL or EXE) to some other project
            will have the effect of importing all public classes in that executable
            into the project to which the reference was added.

            Not that I am actually suggesting you do it that way. But you could
            follow Andrei's first suggestion if you wanted.

            Obviously, I would follow my own advice (which is identical to Andrei's
            second suggestion). Factor the form out into its own DLL project and
            reference that DLL from any project in which you want to use the form
            itself.

            Pete

            Comment

            Working...