473,799 Members | 3,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: Modify a TextBox control

Hi!

Can any one point me in direction of modify a TextBox control.

What i want to do is to add a button, like the ComboBox have. with my own
bitmap
and execute an Event when clicked.

I will use this to bring a lookup table when searching for customers.

Regards
Martin Arvidsson
Nov 17 '05 #1
1 3045
Hi Martin,

just fake it. Create a custum usercontrol.
Place a normal textbox control on it. Then
add a transparent label to the left corner
of the textbox. Add an imagelist to your
control create a gif set this imagelist
as imagelist for your label. At least add
a new textbox and place it over the rest
of the visible underlaying textbox. Set
the second textbox to borderstyle none.
Et voila.

Here is a quick made one. Notice, that you
will have to add your graphics.

Cheers
Lars Behrmann

Nothing is impossible. UML is the key for all your problems.
AODL - Make your .net apps OpenOffice ready
http://aodl.sourceforge.net/

using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Drawing;
using System.Data;
using System.Windows. Forms;

namespace TestControl
{
/// <summary>
/// Zusammenfassung für UserControl1.
/// </summary>
public class UserControl1 : System.Windows. Forms.UserContr ol
{
private System.Componen tModel.IContain er components;
private System.Windows. Forms.TextBox textBox1;
private System.Windows. Forms.Label label1;
private System.Windows. Forms.ImageList imageList1;
private System.Windows. Forms.TextBox textBox2;

private string _test;

public UserControl1(st ring test)
{

InitializeCompo nent();

}
/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Disp ose();
}
base.Dispose( disposing );
}

#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterst ützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert
werden.
/// </summary>
private void InitializeCompo nent()
{
this.components = new System.Componen tModel.Containe r();
System.Resource s.ResourceManag er resources = new
System.Resource s.ResourceManag er(typeof(UserC ontrol1));
this.textBox1 = new System.Windows. Forms.TextBox() ;
this.label1 = new System.Windows. Forms.Label();
this.imageList1 = new
System.Windows. Forms.ImageList (this.component s);
this.textBox2 = new System.Windows. Forms.TextBox() ;
this.SuspendLay out();
//
// textBox1
//
this.textBox1.L ocation = new System.Drawing. Point(0, 0);
this.textBox1.N ame = "textBox1";
this.textBox1.S ize = new System.Drawing. Size(232, 20);
this.textBox1.T abIndex = 0;
this.textBox1.T ext = "";
//
// label1
//
this.label1.Bac kColor = System.Drawing. Color.Transpare nt;
this.label1.Ima geAlign = System.Drawing. ContentAlignmen t.TopLeft;
this.label1.Ima geIndex = 0;
this.label1.Ima geList = this.imageList1 ;
this.label1.Loc ation = new System.Drawing. Point(1, 1);
this.label1.Nam e = "label1";
this.label1.Siz e = new System.Drawing. Size(17, 17);
this.label1.Tab Index = 1;
this.label1.Tex t = "label1";
//
// imageList1
//
this.imageList1 .ImageSize = new System.Drawing. Size(16, 16);
this.imageList1 .ImageStream =
((System.Window s.Forms.ImageLi stStreamer)(res ources.GetObjec t("imageList1.I mageStream")));
this.imageList1 .TransparentCol or = System.Drawing. Color.Transpare nt;
//
// textBox2
//
this.textBox2.A nchor =
((System.Window s.Forms.AnchorS tyles)((((Syste m.Windows.Forms .AnchorStyles.T op
| System.Windows. Forms.AnchorSty les.Bottom)
| System.Windows. Forms.AnchorSty les.Left)
| System.Windows. Forms.AnchorSty les.Right)));
this.textBox2.B orderStyle = System.Windows. Forms.BorderSty le.None;
this.textBox2.L ocation = new System.Drawing. Point(24, 4);
this.textBox2.N ame = "textBox2";
this.textBox2.S ize = new System.Drawing. Size(200, 13);
this.textBox2.T abIndex = 2;
this.textBox2.T ext = "textBox2";
//
// UserControl1
//
this.Controls.A dd(this.textBox 2);
this.Controls.A dd(this.label1) ;
this.Controls.A dd(this.textBox 1);
this.Name = "UserContro l1";
this.Size = new System.Drawing. Size(232, 22);
this.ResumeLayo ut(false);

}
#endregion
}
}


Visual Systems AB (Martin Arvidsson) schrieb:
Hi!

Can any one point me in direction of modify a TextBox control.

What i want to do is to add a button, like the ComboBox have. with my own
bitmap
and execute an Event when clicked.

I will use this to bring a lookup table when searching for customers.

Regards
Martin Arvidsson


Nov 17 '05 #2

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

Similar topics

1
1393
by: VM | last post by:
In my Windows application, I use the streamreader to display a txt file into multi-line textbox and /streamwriter to modify the txt file if the user decides to change the contents through the textbox control. Is there an easier way of doing this? Is there some control that automatically displays a file and modifies it when the user modifies it? Thanks.
2
8404
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
2
3921
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
2
2141
by: leila | last post by:
I am developing an ASP.Net application for a client and they need to modify the page layout from within a form. like the way you edit a blog template in Blogger. what is the best approach to do that in ASP.net? is there a better (and more secure) way than setting permissions so they can edit the .ASPX files in a form? is there any way to use variables in that template instead of <asp:label ...> like the blogger templates?
4
1977
by: clintonG | last post by:
Technically speaking, this issue is not about modifying the HTML generated by server controls but preceding the HTML generated by server controls with an HTML control generated on the basis of the type and the context of the server control itself. Clear as mud? :-) Consider the following server control... <asp:textbox id="MemberEmail" runat="server" ></asp:textbox> TextBox renders at run-time as an HTML control... <input...
1
2568
by: Bennett Haselton | last post by:
If I have this code for repeater, it gives a compilation error saying "The type or namespace name 'MyValue2' could not be found": <asp:Repeater id="MyList" runat="server"> <ItemTemplate> <%#Container.DataItem%><br> <% MyValue2.Text = "ghi"; %> <asp:TextBox ID="MyValue2" Runat="server"/> <br> </ItemTemplate>
7
2141
by: I am Sam | last post by:
I have a DataGrid that is passing information to a stored procedure properly but the parameters aren't being casted properly. I was woundering if anyone can tell me how I should properly cast the following: (TextBox)UserPrefix=(TextBox)e.Item.Cells.Controls; string strUserPrefix=UserPrefix.Text; I keep getting the following error and I don't know why because I have declared the UserPrefix as a textbox using "protected...
2
19876
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
4
2502
by: CodeLeon | last post by:
I am designing an enhanced GUI suite, and i need to know how to: * Make a user control a "helper" control, ie, one that sits at the bottom (like timer or process) * Make this control modify the behavior of the painted controls already on the form. (ie, make my control handle the painting of the controls on the page) * Make the TextBox contol have it's background painted by me. This seems to be a hassle. Any help would be deeply...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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
10484
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
10251
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...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
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();...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
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.