Set the toolbox icon and default text for a control

G

Guest

Hi,

I have create an inherited control (a TextBox which doesn't accept numbers)
and have added it to my toolbox.

Can anyone give pointers on how to set the Text to "" when an instance of
this control is dropped onto a Windows form? I have set the Text to "" in
the constructor for the control but it still shows NoNumbers1, NoNumbers2,
etc.

Also, a quick reminder on how to set the toolbox icon would be appreciated.
 
G

Guest

You set the toolbox bitmap icon with teh System.Drawing.ToolboxBitmapAttribute
and I think you need to set the System.ComponentModel.DefaultValueAttibute
for the text property to specify what to make it when a new one is made in
the designer.

HTH

Ciaran O'Donnell
 
C

Claes Bergefall

Can anyone give pointers on how to set the Text to "" when an instance of
this control is dropped onto a Windows form? I have set the Text to "" in
the constructor for the control but it still shows NoNumbers1, NoNumbers2,
etc.

Provide a custom designer inherited from ControlDesigner. Specify the
initial values by overriding InitializeNewComponent method

Also, a quick reminder on how to set the toolbox icon would be
appreciated.

See Ciaran's post


/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top