I have never tried to make an extended control using the user control first. I have made one by just creating a simple code file and setting up my own class. This code works fine:
----> [ToolboxItem(true)] public class VrTextBox : TextBox { private Boolean _selectOnEntry = true; [DefaultValue(true), Category("Behavior")] public Boolean SelectOnEntry { get { return _selectOnEntry; } set { _selectOnEntry = value; } } protected override void OnGotFocus(EventArgs e) { if(_selectOnEntry) SelectAll(); base.OnGotFocus(e); } } <---- You will then need to customize your toolbox and add this control to it. -- Peter > Jeff Smith spake: > > I am trying to create a basic textbox control similar to the Masked Edit > Control that was in VB. I create a new c# windows application, add a new > user control called "TestUserControl" and then I go into the code and > change it to inherit from System.Windows.Forms.TextBox instead of > UserControl. > > It is in my toolbox automatically, but when I drop it on the form I > get "The control ... could not be loaded. Ensure the library > containing the > control has been built and a project reference has been made to > the library > containing the control. If you have changed the name of the user control, > close and re-open the control's designer to update the toolbox item". > > I have not changed the name (just the base class), I have compiled the > project before trying to drop it on the form with the form > designer. I have > even tried going to "customize toolbox" and adding a reference to my > own .EXE file and then I get an additional "TestUserControl" entry in the > toolbox that when I drop on the form gives me an error of "Object > reference > not set to an instance of an object". > > What the F$#!@ am I doing wrong? This should be so simple. I have checked > all over the net. The only suggestions I saw were compiling and adding a > reference to your EXE. > > Thanks, > Jeff You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.