473,402 Members | 2,050 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,402 software developers and data experts.

creating my own textbox in VS.Net

Hi,

I need to create a textbox which acts as a normal textbox but with the
following extra requirements:

1) In-focus color, when the textbox gets focus the backcolor property
of the textbox should be set to a, selectable, in-focus color.
2) Out-of-focus color, when the textbox loses focus the backcolor
property of the textbox should be set to a, selectable, out-of-focus
color.
3) Enter pressed, the textbox should also have the property that when
the enter key is pressed focus should move to the next control without
beeping.
4) Toolbox, this new textbox should easily be drag'n'dropped from the
Toolbox on to a Form in VS.NET, as a normal textbox.
5) Databinding, the databinding properties of the textbox should be
easily accessed in VS.NET, as a normal textbox.

As I see it there are two ways of solving this. I can create my
textbox by inheriting (Soluiton A) from System.Windows.Forms.TextBox
or (Solution B) from System.Windows.Forms.UserControl.

The A solution allows me to implement requirements 1-3 by using the
textbox events "Enter", "Leave" and "Key Pressed", but it is still
beeping when using the "Key Pressed" event! Regarding requirement 4, I
have no idea how to achieve this. Is there an interface that I should
implement inorder to make this work? Requirement 5, I can solves this
by first drag'n'dropp a normal textbox on to my form and then I can,
manually, change the type of this textbox e.g. from
System.Windows.Forms.TextBox to myTextBox. But this solution costs
alot of time when one might have 5-10 textbox's on each form and I
have over 20 form's. Isn't there a better way of doing this?

The B solution allows me to put a textbox in my user control. So,
requirements 1-3 can be implemented using different events from the
userControl and the textbox. Requirement 4 is easy in this case, I can
just select "Add/Remove Item" on the toolbox and so on. Regarding the
fifth requirement, the databinding, only the databinding properties
that belongs to the user control is editable in the properties when my
new textbox is placed in a form. How can I make the databinding work
in VS.Net on the textbox which is inside the user control?

Can anyone help me? I am writing the code in C#.

Regards
Jonas
Nov 15 '05 #1
0 2093

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Grisha0 | last post by:
Hi, i've got a little question. I'd like to create an object for example TextBox normaly it'd like look like this: TextBox my_Object = new TextBox(); but i'd like to get the name of the...
2
by: Anand Sagar | last post by:
I have a Panel1 and button1 on my webform. At runtime, I create 2 textboxes. I do it at the Page_Load event. I put the code within the " If Not isPostBack" For the button click event, I will do...
2
by: DaWoE | last post by:
Hi all, I'm fairly new to ASP.NET. What i want to do is creat a online registration form. On the first step is getting the users details and the number of people he wants to register. Based on...
2
by: Zyrthofar Blackcloak | last post by:
Hello everyone! I just wanted to know how I can create a font from bitmaps in memory (currently in an array), or from GDI+. I want to be able to use that font in a textbox, for example. I have...
1
by: Flack | last post by:
Hey guys, Here is whats happening. I have a StringBuilder, a TextBox, and a TabControl with one TabPage. On my main form, I created and displayed a fairly big maze. While the app is solving...
0
by: Tom | last post by:
I have about 30 labels and textboxes on my web form and the user can input data into the text boxes. Then they click a button and a text file needs to be created. I can create the text file but how...
4
by: George Ter-Saakov | last post by:
I am adding some functionality to HtmlInputText so i derived my class from it. The problem is when i switch page to desing mode the VS shows an error and do not render control. Unable to cast...
1
by: deepapanch | last post by:
Hi All: I am new to C#. Have created a simple outlook add-in, which adds a command bar in Outlook. On click of the button, I would like to load the a simple dialog with a Text Box and a...
5
by: divyasrinivasan | last post by:
hi how to add MULTIPLE TEXTBOX at runtime using CLASS FILE i tried using this code for creating textbox but it did not work textbox t=new textbox(); t.id="mytextbox"; panel p=new panel();...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.