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. Using Custom Controls in Designer from .cs source files

Using Custom Controls in Designer from .cs source files

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 3 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.
  • F Offline
    F Offline
    Florian Storck
    wrote on last edited by
    #1

    Hi, I have the following problem when trying to use Custom Controls published here at CodeProject with the full source code: 1.) I add the control source to my project 2.) Project compiles, everythings fine. When I now want to add the control using the designer, I have to import it from the binary assembly the project has created ( so I'm referencing myself). Is there another way of registering in the toolbox just using the sourcecode ? Its a bit annoying, because I get a warning that I'm using a different type. The most ExampleProjects have all integrated, but don't reference the outputbinary for having designer support. I don't want to create a separate assembly containing all controls at the moment and I didn't found another solution yet. Many thanks, Florian

    R 1 Reply Last reply
    0
    • F Florian Storck

      Hi, I have the following problem when trying to use Custom Controls published here at CodeProject with the full source code: 1.) I add the control source to my project 2.) Project compiles, everythings fine. When I now want to add the control using the designer, I have to import it from the binary assembly the project has created ( so I'm referencing myself). Is there another way of registering in the toolbox just using the sourcecode ? Its a bit annoying, because I get a warning that I'm using a different type. The most ExampleProjects have all integrated, but don't reference the outputbinary for having designer support. I don't want to create a separate assembly containing all controls at the moment and I didn't found another solution yet. Many thanks, Florian

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      I think VS 2005 hadnles this issue better than VS 03. For VS2003 and if the control is inheriting from UserControl than double clicking it (so that the designer view pops up) then it should automatically being added to the toolbox.

      F 1 Reply Last reply
      0
      • R Robert Rohde

        I think VS 2005 hadnles this issue better than VS 03. For VS2003 and if the control is inheriting from UserControl than double clicking it (so that the designer view pops up) then it should automatically being added to the toolbox.

        F Offline
        F Offline
        Florian Storck
        wrote on last edited by
        #3

        Hi Robert, if I click on the control sourcecode item ( e.g. Control.cs) i get a screen with the follwing text (window tab says "Control.cs [Design]": To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create events for your class, click here to switch to code view. Well, that pretty obvious, but I have no idea how to convince the toolbox when editing a form to display the control which is only existing in sourcecode at that moment. Ok, it seems that the Control I use is not inherited from UserControl, so it may not work here. But you mean, if doubleclicking the sourcefile in the project should be enough if it is inherited from UserControl ? Thanks, Florian

        D 1 Reply Last reply
        0
        • F Florian Storck

          Hi Robert, if I click on the control sourcecode item ( e.g. Control.cs) i get a screen with the follwing text (window tab says "Control.cs [Design]": To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create events for your class, click here to switch to code view. Well, that pretty obvious, but I have no idea how to convince the toolbox when editing a form to display the control which is only existing in sourcecode at that moment. Ok, it seems that the Control I use is not inherited from UserControl, so it may not work here. But you mean, if doubleclicking the sourcefile in the project should be enough if it is inherited from UserControl ? Thanks, Florian

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Keep the control code seperate from your own. Make the control it's own seperate Project, then you can have it show up in the ToolBox. Dave Kreskowiak Microsoft MVP - Visual Basic

          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