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. What is the right way to create inherited classes derived from System.Windows.Forms.TextBox?

What is the right way to create inherited classes derived from System.Windows.Forms.TextBox?

Scheduled Pinned Locked Moved C#
questiondotnetvisual-studiowinformsdebugging
3 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.
  • R Offline
    R Offline
    rudy net
    wrote on last edited by
    #1

    I created a class inherited from TextBox and to add it into my forms I just added Windows TextBox objects then modified the code created by VS by modifying the type to my own textbox class. This worked fine for a while; however, all of sudded all my controls dissapeared. This must have happened because I emptied the folder that contained my custom TextBox. So to prevent this from happening in the future, what is the right way of adding custom controls to windows forms so it doesn't wipe them out automatically? I also have some classes inherited from "System.Windows.Forms.UserControl" and the same problem happened a while ago, so before I start creating a form with a whole bunch of my custom controls I would rather figure out how to add them the right way to prevent them from disappearing. Please don't tell me I have to add my controls to the GAC. That would be a pain. Reason is that a while ago I added some dll's to the GAC and when I wanted to step through my code, it wouldn't step in and I couldn't figure out the reason. Finally I removed my dll from GAC and then I could go in debug mode. Maybe I did something wrong here as well, so please feel free to comment. :sigh:

    F 1 Reply Last reply
    0
    • R rudy net

      I created a class inherited from TextBox and to add it into my forms I just added Windows TextBox objects then modified the code created by VS by modifying the type to my own textbox class. This worked fine for a while; however, all of sudded all my controls dissapeared. This must have happened because I emptied the folder that contained my custom TextBox. So to prevent this from happening in the future, what is the right way of adding custom controls to windows forms so it doesn't wipe them out automatically? I also have some classes inherited from "System.Windows.Forms.UserControl" and the same problem happened a while ago, so before I start creating a form with a whole bunch of my custom controls I would rather figure out how to add them the right way to prevent them from disappearing. Please don't tell me I have to add my controls to the GAC. That would be a pain. Reason is that a while ago I added some dll's to the GAC and when I wanted to step through my code, it wouldn't step in and I couldn't figure out the reason. Finally I removed my dll from GAC and then I could go in debug mode. Maybe I did something wrong here as well, so please feel free to comment. :sigh:

      F Offline
      F Offline
      Fernando Soto
      wrote on last edited by
      #2

      Hi; To add your custom control on to the toolbox in VS do the following steps: 1: Create a directory somewhere on your system where you will place your custom control dll's in. Do not delete this directory or it contents. If you do the controls will not show up in your Toolbox or any forms you put them on VS.Net. 2: Go to the Toolbox and select the tab you want the control to show up on, or create a new tab by right clicking on the Toolbox and select Add Tab from the menu and fill in the tab name at the bottom of the Toolbox and press enter key. Then click on the tab. 3: Right click on the Toolbox and select Add/Remove Toolbox Items... 4: In the Customize Toolbox dialog make sure that the .Net Framework Components tab is selected and then click on the Browse... button. 5: Now navigate to the directory you created in step 1 and double click on the custom control dll you want to add. 6: Your control should now have a check mark next to it and its version number at the bottom of the page. click the OK button. Now any time you need your control just go to the toolbox and drag it on to the form. I hope this has been of some help. :) -Fernando Soto

      R 1 Reply Last reply
      0
      • F Fernando Soto

        Hi; To add your custom control on to the toolbox in VS do the following steps: 1: Create a directory somewhere on your system where you will place your custom control dll's in. Do not delete this directory or it contents. If you do the controls will not show up in your Toolbox or any forms you put them on VS.Net. 2: Go to the Toolbox and select the tab you want the control to show up on, or create a new tab by right clicking on the Toolbox and select Add Tab from the menu and fill in the tab name at the bottom of the Toolbox and press enter key. Then click on the tab. 3: Right click on the Toolbox and select Add/Remove Toolbox Items... 4: In the Customize Toolbox dialog make sure that the .Net Framework Components tab is selected and then click on the Browse... button. 5: Now navigate to the directory you created in step 1 and double click on the custom control dll you want to add. 6: Your control should now have a check mark next to it and its version number at the bottom of the page. click the OK button. Now any time you need your control just go to the toolbox and drag it on to the form. I hope this has been of some help. :) -Fernando Soto

        R Offline
        R Offline
        rudy net
        wrote on last edited by
        #3

        Thanks, your detailed steps sure help.

        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