473,326 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 3226
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Rigs | last post by:
Hi, I have a textbox with a Custom Validator that utilizes the OnServerValidate method for that textbox. This works fine, however the method only executes when data exists in that textbox after...
5
by: Alex Nitulescu | last post by:
Hi. Because I'm a beginner in creating controls, I spent more than two *&^#$ hours to create this "login" as a custom control and to make it work properly: ...
1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
3
by: Wayne | last post by:
1. I have created my own class that inherits the textbox (called it CyanFocusTextBox). I put in some code and some new properties. All this works. I build the dll that contains this class...
3
by: Ranginald | last post by:
Hey, I'm trying to create a simple class to create a textbox, and then instantiate it from a page (so I can resue it across an asp.net app). I've been scratching my head but I can't get this to...
0
by: rn5a | last post by:
A custom control is derived from the WebControl class & encapsulates a TextBox & a Button. When the Button is clicked, the user is shown the JavaScript confirm dialog with the 'OK' & 'Cancel'...
8
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property...
2
by: Michal Valent | last post by:
I would like to fire some custom server control event before Page_Load event like this (from the trace of an aspx page) : Trace Information Category Message From First(s) From Last(s) aspx.page...
4
by: Jeff | last post by:
hi asp.net 2.0 I have created a custom web control, here is it's header: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditUserBox.ascx.cs" Inherits="Controls_EditUserBox" %> ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.