By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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.