468,107 Members | 1,475 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

i'm tyring to create a custom textbox class, but there is no UI

i'm trying to create a custom textbox class, by simply creating a new class
& inheriting from the textbox class.
But i don't have a UI of this class.
I.e., how can i set up the default text, color for this text box - via the
properties window if there is no UI.
Currently i'm doing this via code & this is a headache, cuz i've got to drop
this control onto a form & then check out whether my UI changes are as
required.

Is there a way for me to see this custom class UI while in design mode.

Just as i creat a custom Form, i can inherit from a existing windows form &
see the UI....
Nov 21 '05 #1
4 3004
You are on the right track. The UI is available through the instantiated
version, when you inherit directly from a control. Create your inherited
class in a separate control library, which compiles to a dll. From the
Toolbox, you can add the dll, which will be in the bin folder of the project.
The control library should show its controls as checked, as you add it in.
Remember to set a reference to your controls library inside your exe project.

You can override OnCreateControl, in your inherited control. It acts like a
Load event. You can prompt a read of default properties there.

Protected Overrides Sub OnCreateControl()
MyBase.Text = Me.Text
MyBase.OnCreateControl()
End Sub

You can set default properties as follows.

Private _Text As String = "New Text"
Public Shadows Property Text() As String
Get
Return Me._Text
End Get
Set(ByVal Value As String)
Me._Text = Value
End Set
End Property

When you instantiate the control on a form from the Toolbox, the properties
will be available just as they would for a standard Textbox.

www.charlesfarriersoftware.com

"Antuane" wrote:
i'm trying to create a custom textbox class, by simply creating a new class
& inheriting from the textbox class.
But i don't have a UI of this class.
I.e., how can i set up the default text, color for this text box - via the
properties window if there is no UI.
Currently i'm doing this via code & this is a headache, cuz i've got to drop
this control onto a form & then check out whether my UI changes are as
required.

Is there a way for me to see this custom class UI while in design mode.

Just as i creat a custom Form, i can inherit from a existing windows form &
see the UI....

Nov 21 '05 #2
Also, remember to add your controls project to the solution. You can create
it as a new project under the solution.

"Antuane" wrote:
i'm trying to create a custom textbox class, by simply creating a new class
& inheriting from the textbox class.
But i don't have a UI of this class.
I.e., how can i set up the default text, color for this text box - via the
properties window if there is no UI.
Currently i'm doing this via code & this is a headache, cuz i've got to drop
this control onto a form & then check out whether my UI changes are as
required.

Is there a way for me to see this custom class UI while in design mode.

Just as i creat a custom Form, i can inherit from a existing windows form &
see the UI....

Nov 21 '05 #3
"Antuane" <An*****@testing.com.net> schrieb:
i'm trying to create a custom textbox class, by simply creating a new
class
& inheriting from the textbox class.
But i don't have a UI of this class.
I.e., how can i set up the default text, color for this text box - via the
properties window if there is no UI.
Currently i'm doing this via code & this is a headache, cuz i've got to
drop
this control onto a form & then check out whether my UI changes are as
required.

Is there a way for me to see this custom class UI while in design mode.


You mean a graphical editor like for usercontrols and forms? No, that's not
possible for controls that are no forms or usercontrols. You'll have to set
the properties through code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
thanx a lot guys, lots of useful tips there.

"Antuane" <An*****@testing.com.net> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl...
i'm trying to create a custom textbox class, by simply creating a new class & inheriting from the textbox class.
But i don't have a UI of this class.
I.e., how can i set up the default text, color for this text box - via the
properties window if there is no UI.
Currently i'm doing this via code & this is a headache, cuz i've got to drop this control onto a form & then check out whether my UI changes are as
required.

Is there a way for me to see this custom class UI while in design mode.

Just as i creat a custom Form, i can inherit from a existing windows form & see the UI....

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Sanjay Pais | last post: by
reply views Thread by rn5a | last post: by
8 posts views Thread by =?Utf-8?B?QXNo?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.