Windows Form to dll

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VGlhZ28gTWFycXVlcw==?=

    #1

    Windows Form to dll

    Hi all,

    I created a windows form, and I want to use it on other applications. To do
    that I think that it would be better to create a dll and on the new
    applications create a reference to it.
    It is almost like a dialogbox.

    Is it possible to be done? How?

    I'm using c# on visual studio 2005.

    Thank you all
  • Peter Duniho

    #2
    Re: Windows Form to dll

    On Thu, 06 Nov 2008 05:50:00 -0800, Tiago Marques
    <TiagoMarques@d iscussions.micr osoft.comwrote:
    I created a windows form, and I want to use it on other applications. To
    do
    that I think that it would be better to create a dll and on the new
    applications create a reference to it.
    It is almost like a dialogbox.
    >
    Is it possible to be done? How?
    The same way you'd deploy any C# class in a DLL. Just write the project
    containing the class, set the output type for the project to DLL, and then
    reference the DLL in whatever other project you want to use it.

    Pete

    Comment

    • =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?=

      #3
      RE: Windows Form to dll


      "Tiago Marques" wrote:
      Hi all,
      >
      I created a windows form, and I want to use it on other applications. To do
      that I think that it would be better to create a dll and on the new
      applications create a reference to it.
      It is almost like a dialogbox.
      >
      Is it possible to be done? How?
      >
      I'm using c# on visual studio 2005.
      >
      Thank you all
      Hi Tiago,

      To create a dll just change the output type in the project properties to
      Class Library. To use the Forms in another project add a reference to your
      dll (browse or use project reference if you have both projects in the same
      solution) and create the forms as usual.

      --
      Happy Coding!
      Morten Wennevik [C# MVP]

      Comment

      • DaveL

        #4
        Re: Windows Form to dll

        If the New form is already in a Windows project that has to stay windows
        application..

        1. Create new Dll Project
        2. Copy Form.cs, FormDesigner.cs and form.resx
        into the new dll project Folder
        3. Add Existing

        set the namespace or leave them...
        thats all

        DaveL


        "Tiago Marques" <TiagoMarques@d iscussions.micr osoft.comwrote in message
        news:EF552CEC-6038-4384-BF3E-0292D84F35C3@mi crosoft.com...
        Hi all,
        >
        I created a windows form, and I want to use it on other applications. To
        do
        that I think that it would be better to create a dll and on the new
        applications create a reference to it.
        It is almost like a dialogbox.
        >
        Is it possible to be done? How?
        >
        I'm using c# on visual studio 2005.
        >
        Thank you all

        Comment

        • =?Utf-8?B?VGFudHIgTWFudHI=?=

          #5
          RE: Windows Form to dll

          Hi, Any reason why you cant use the Forms project directly as is? I agree
          that you will/might refactor your forms code considering other projects are
          now going to use its methods.

          You should be able to reference the forms .exe directly in the project you
          want to use it.

          Cheers


          "Morten Wennevik [C# MVP]" wrote:
          >
          "Tiago Marques" wrote:
          >
          Hi all,

          I created a windows form, and I want to use it on other applications. To do
          that I think that it would be better to create a dll and on the new
          applications create a reference to it.
          It is almost like a dialogbox.

          Is it possible to be done? How?

          I'm using c# on visual studio 2005.

          Thank you all
          >
          Hi Tiago,
          >
          To create a dll just change the output type in the project properties to
          Class Library. To use the Forms in another project add a reference to your
          dll (browse or use project reference if you have both projects in the same
          solution) and create the forms as usual.
          >
          --
          Happy Coding!
          Morten Wennevik [C# MVP]

          Comment

          Working...