473,702 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.UserContr ol.

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 2125

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

Similar topics

5
2409
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 instance from a string. string name = "my_object_name_from_string"; TextBox name = new TextBox();
2
2896
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 a post-to-database coding and then show the same page again. I put EnableViewState = True for the textboxes. In the Page_Load if I dont use the IsPostBack checking, the code works fine. The button shows that the code has been fired and the page...
2
2009
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 the number of people i want to create a form where he can enter the persons details. For example he wants to register 3 people. Then the second step of the registration would have to be like this :
2
1263
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 searched a bit on msdn and google, but didn't find anything useful. A hint or a link would be appreciated :) Thank you all
1
8603
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 the maze, it appends each step it takes to the StringBuilder. When the maze is solved, the user can click a menu item to display the results. When the menu item is clicked, I set the TextBox Text value using the StringBuilder's ToString()...
0
1198
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 can I format the file as such? web form looks like this: label textbox textbox label label textbox textbox label label textbox textbox label
4
2155
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 object of type 'System.Web.UI.Design.HtmlIntrinsicControlDesigner' to type 'System.Web.UI.Design.ControlDesigner' Not sure how to fix it and make it work in design time
1
2968
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 Button. I would like to populate the textbox with a value, before displaying it. To accomplish this, I tried creating a custom control (Test Control)
5
2322
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(); p.controls.add(t); i want it using class file pls help its very urgent...
0
8652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9234
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9089
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8983
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8940
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5907
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4412
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.