By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,708 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,708 IT Pros & Developers. It's quick & easy.

modifying standart textbox

P: n/a
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"
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,
This is not the best way of doing it, you should inherint from Control and
then insert both controls as needed.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"David" <da*******@hotmail.com> wrote in message
news:uL*************@TK2MSFTNGP12.phx.gbl...
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"

Nov 16 '05 #2

P: n/a
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...
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:ey**************@TK2MSFTNGP10.phx.gbl...
Hi,
This is not the best way of doing it, you should inherint from Control and
then insert both controls as needed.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"David" <da*******@hotmail.com> wrote in message
news:uL*************@TK2MSFTNGP12.phx.gbl...
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"


Nov 16 '05 #3

P: n/a
Hi,

Do you have to use a TextBox collection ??

why not use a Control collection?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"David" <da*******@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
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...

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:ey**************@TK2MSFTNGP10.phx.gbl...
Hi,
This is not the best way of doing it, you should inherint from Control and then insert both controls as needed.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"David" <da*******@hotmail.com> wrote in message
news:uL*************@TK2MSFTNGP12.phx.gbl...
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"



Nov 16 '05 #4

P: n/a
couse, i need to use some properties only textbox have...

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2***************@tk2msftngp13.phx.gbl...
Hi,

Do you have to use a TextBox collection ??

why not use a Control collection?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"David" <da*******@hotmail.com> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
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...


"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>

wrote
in message news:ey**************@TK2MSFTNGP10.phx.gbl...
> Hi,
>
>
> This is not the best way of doing it, you should inherint from Control and > then insert both controls as needed.
>
> Cheers,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
>
>
> "David" <da*******@hotmail.com> wrote in message
> news:uL*************@TK2MSFTNGP12.phx.gbl...
>> 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"
>>
>>
>
>



Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.