I\'m trying to make a TextBox with a button on the right side. My code:
public partial class TextBoxButton : TextBox
{
[Category(\"Button\")]
[Descri
If you really want to add the button to the textbox then follow these steps:
Paste the following code in the Load event:
Button btn = new Button();
btn.Parent = textBox1;
btn.BringToFront();
textBox1.Controls.Add(btn);
btn.BackColor = Color.Gray;
btn.Text = "Help!";
As you can see the button hides the unerlying text, however it does appear to be fully functional.
I believe that what you really mean to do is to place the button along side the textbox. Perhaps use a Panel control to contain both of the controls.
Also whenever you add a control to another controls - control collection you must set the parent control to the control you've added it to. Capiche? (Sorry for the wordiness ;)
In other words, you are not setting the textbox as the parent control of the button.
As an aside, WPF might have the ability to do this And to flow the text around the button!