CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2006
    Posts
    22

    Smile switch between two properties

    Have anyone an idea how can switch between two properties (Resources.resx, Settings.settings...)
    Last edited by daniel94ever; February 26th, 2007 at 02:28 PM.

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: switch between two properties

    Maybe you could explain in more detail what you need to achieve?

    - petter

  3. #3
    Join Date
    Nov 2006
    Posts
    22

    Re: switch between two properties

    I want to build two programs with the same code but different designs.

  4. #4
    Join Date
    Jan 2007
    Posts
    70

    Re: switch between two properties

    Quote Originally Posted by daniel94ever
    I want to build two programs with the same code but different designs.
    So you do not want to share any UI stuff but only the program code?

    Have you considered making two separate projects which share a .cs file containing the program code?

    Instead of importing a .cs file into a project, you can link to the file. If you have a file in Project1 and want to use it in Project2:
    Open Project2.
    In Solution Explorer, right click on Project2.
    Select "Add" in the menu.
    Select "Existing Item..." in the menu.
    In the File Open dialog, find and select the file you want to link to.
    On the "Add" button there is a little arrow. Click it, and select "Add As Link".

    I use this myself to share code between projects. The upside is that you only need to change the code in one place. The downside is that you may break functionality in one of the other projects every time you change the code in one project.

  5. #5
    Join Date
    Nov 2006
    Posts
    22

    Re: switch between two properties

    Thanks Allan.

    But I´m looking for a way to use differnet Resource.resx and Settings.settings.

  6. #6
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    1,475

    Re: switch between two properties

    Allan, in your way you compile the same code twice - once for each project.

    You might want to consider creating a third assembly - a Class Library - and put all the common code there. The advantage is that you have a closed assembly that can be referenced by any other assembly. The downside is that you have another dll to deploy.

    daniel94ever, I don't see the problem with Resources and Settings. You might want to explain it better.

  7. #7
    Join Date
    Jan 2007
    Posts
    70

    Re: switch between two properties

    Quote Originally Posted by jhammer
    You might want to consider creating a third assembly - a Class Library - and put all the common code there.
    I actually first used that approach and then left it for the approach I described.

    It would probably be a maintenance nightmare when done on a large scale but for my own small cross-platform project (SmartPhone+PC) where DLLs cannot be shared between platforms, it is much easier to share the source code itself.

    Quote Originally Posted by daniel94ever
    Thanks Allan.

    But I´m looking for a way to use differnet Resource.resx and Settings.settings.
    Two projects = Two Resources.resx.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured