modifying standart textbox

  • Thread starter Thread starter David
  • Start date Start date
D

David

hello...

i coded these:

public class TextBoxBrowse : TextBox
{
public TextBoxImgBrowse () : base ()
{
Button b = new Button();
b.Size = new System.Drawing.Size(24, 21);
b.Dock = DockStyle.Left;
b.Text = "...";
b.Click += new EventHandler(b_Click);
this.Controls.Add (b);
}
}

so as you see the standart textbox will now have button on it, the problem
is what in some cases text will be hidden under thet button, how can i solve
that problem, then staying under textbox, i mean that TextBoxBrowse must be
declared like "TextBoxBrowse : TextBox"
 
Hi,


This is not the best way of doing it, you should inherint from Control and
then insert both controls as needed.

Cheers,
 
in 99% of cases i'll accept with you, i need to add this my control to
TextBoxex collection, so the only way to do it is to inherit from TextBox...
 
Hi,

Do you have to use a TextBox collection ??

why not use a Control collection?

Cheers,
 
Back
Top