Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Custom WinForm Inheritance

Custom WinForm Inheritance

Scheduled Pinned Locked Moved C#
csharpwinformsoophelpannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 3 Offline
    3 Offline
    3green
    wrote on last edited by
    #1

    After lots of research I still cant find an effective way of inheriting windows forms from my custom window forms. In Vis Studio 2005 in C# I have a dll project MyWinFormProject which includes a customised winform "MyWinForm" and builds into MyWinFormProject.dll. I have a seperate standard C# windows app project WindowsApplication1. When in WindowsApplication1 I add a new inheriited form Form1 which I want to inherit from MyWinForm. I have been trying 2 ways of doing this: 1. 'Export Template', MyWinForm from MyWinFormProject which creates a zip file. Then go through the Add Item Dialog, but this then exposes all confidential source code of MyWinForm in Form1, which is unsuitable. 2. Go through the Add Item Dialog -> Inheritance Dialog and browse to MyWinFormProject.dll and add this as a reference and inherit from MyWinForm in the componet list. This adds MyWinFormProject.dll to the WindowsApplication1 project bin folder. This approach works fine until I try to add a second winform Form2 inherited from MyWinForm, then I get the error message "Uanble to Add reference......Check a different version of 'MyWinFormProject' is not already referenced. Many thanks Steven Spencer.

    M 1 Reply Last reply
    0
    • 3 3green

      After lots of research I still cant find an effective way of inheriting windows forms from my custom window forms. In Vis Studio 2005 in C# I have a dll project MyWinFormProject which includes a customised winform "MyWinForm" and builds into MyWinFormProject.dll. I have a seperate standard C# windows app project WindowsApplication1. When in WindowsApplication1 I add a new inheriited form Form1 which I want to inherit from MyWinForm. I have been trying 2 ways of doing this: 1. 'Export Template', MyWinForm from MyWinFormProject which creates a zip file. Then go through the Add Item Dialog, but this then exposes all confidential source code of MyWinForm in Form1, which is unsuitable. 2. Go through the Add Item Dialog -> Inheritance Dialog and browse to MyWinFormProject.dll and add this as a reference and inherit from MyWinForm in the componet list. This adds MyWinFormProject.dll to the WindowsApplication1 project bin folder. This approach works fine until I try to add a second winform Form2 inherited from MyWinForm, then I get the error message "Uanble to Add reference......Check a different version of 'MyWinFormProject' is not already referenced. Many thanks Steven Spencer.

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello, To 2. Look at the references. Is there a second referenc to your dll? If yes you can delete it manually and try to compile again. All the best, Martin

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups