473,322 Members | 1,401 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,322 software developers and data experts.

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 3020
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.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace TestControl
{
/// <summary>
/// Zusammenfassung für UserControl1.
/// </summary>
public class UserControl1 : System.Windows.Forms.UserControl
{
private System.ComponentModel.IContainer 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(string test)
{

InitializeComponent();

}
/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
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 InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(UserContro l1));
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.imageList1 = new
System.Windows.Forms.ImageList(this.components);
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(0, 0);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(232, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.label1.ImageIndex = 0;
this.label1.ImageList = this.imageList1;
this.label1.Location = new System.Drawing.Point(1, 1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(17, 17);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resource s.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// textBox2
//
this.textBox2.Anchor =
((System.Windows.Forms.AnchorStyles)((((System.Win dows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox2.Location = new System.Drawing.Point(24, 4);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(200, 13);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// UserControl1
//
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Name = "UserControl1";
this.Size = new System.Drawing.Size(232, 22);
this.ResumeLayout(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
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...
2
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...
2
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...
2
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...
4
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...
1
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>...
7
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...
2
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
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.