How to put an extended WinForms Control on ToolBox
c#, winforms
Solution
- Build you project with TextBoxExt, make sure it compiles ok.
- With the form that you want TextBoxExt on, open the toolbox, right click and select "choose items"
- Browse to you .exe or dll that you compiled in 1)
- make sure that TextBoxExt has a tick next to it, press ok
- TextBoxExt should appear in the toolbox, drag it onto your form
(There is another way of doing this, opening the designer file and renaming the instances of TextBox to TextBoxExt but manual editing of designer files can be considered hazardous by some)
Problem
I plan to add functionalities to TextBox with the following: ``` public class TextBoxExt : TextBox { protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); } } ``` The question is how can we use this TextBoxExt? Is there anyway to get this class onto the ToolBox so that we can just drag and drop it onto the form? If not, what is the best way to use the TextBoxExt?