Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Dave Kreskowiak22-Aug-13 6:21
mveDave Kreskowiak22-Aug-13 6:21 
AnswerRe: Block webbrowser from accessing webpages in C# Pin
Bernhard Hiller21-Aug-13 21:55
Bernhard Hiller21-Aug-13 21:55 
QuestionBluetooth Pairing Problem Win8 Pin
LearnTheCoding20-Aug-13 20:50
LearnTheCoding20-Aug-13 20:50 
QuestionCollection with unique key by property Pin
Elfin Darkglow20-Aug-13 17:51
Elfin Darkglow20-Aug-13 17:51 
AnswerRe: Collection with unique key by property Pin
BillWoodruff20-Aug-13 19:14
professionalBillWoodruff20-Aug-13 19:14 
AnswerRe: Collection with unique key by property Pin
Bernhard Hiller20-Aug-13 21:12
Bernhard Hiller20-Aug-13 21:12 
QuestionHow To Add Buttons In Textbox? Pin
gaofq20-Aug-13 16:03
gaofq20-Aug-13 16:03 
AnswerRe: How To Add Buttons In Textbox? Pin
BillWoodruff20-Aug-13 18:13
professionalBillWoodruff20-Aug-13 18:13 
You cannot drag-and-drop a Button into a TextBox Control at design-time, but, yes, you could, in code, add one to the Controls Collection of a TextBox.
// assume you have a Button, 'button1 on the Form
// assume you have a TextBox, 'textBox1 on the Form
private void Form1_Load(object sender, EventArgs e)
{
    // code you should never write !
    this.Controls.Remove(button1);
    textBox1.Controls.Add(button1);
    button1.Location = new Point(2, 2);

    // yes, the Click Event Handler will work
    button1.Click += button1_Click;
}

private void button1_Click(object sender, EventArgs e)
{
    MessageBox.Show("Monster speaking: 'in the TextBox: A Button'");
}
But, what you end up with is a mess:

The Button will obscure what you are typing that is in the Button's DisplayRectangle ... unless you do some real weird stuff ... not even sure it could be done ... to make sure that when you typed, what you typed would never be covered over by the Button.

Believe me: you do not want to do the above !

The simple way to achieve a combination of Button(s) and TextBox, in one nice package, is to create a UserControl, and put the Button(s) where you like, and the TextBox where you like.

~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal


modified 21-Aug-13 3:03am.

GeneralRe: How To Add Buttons In Textbox? Pin
gaofq21-Aug-13 4:43
gaofq21-Aug-13 4:43 
GeneralRe: How To Add Buttons In Textbox? Pin
Ravi Bhavnani21-Aug-13 7:38
professionalRavi Bhavnani21-Aug-13 7:38 
GeneralRe: How To Add Buttons In Textbox? Pin
BillWoodruff21-Aug-13 11:31
professionalBillWoodruff21-Aug-13 11:31 
GeneralRe: How To Add Buttons In Textbox? Pin
Ravi Bhavnani21-Aug-13 11:37
professionalRavi Bhavnani21-Aug-13 11:37 
GeneralRe: How To Add Buttons In Textbox? Pin
Mycroft Holmes21-Aug-13 12:53
professionalMycroft Holmes21-Aug-13 12:53 
QuestionTreeview node folder images Pin
rfresh20-Aug-13 13:28
rfresh20-Aug-13 13:28 
AnswerRe: Treeview node folder images Pin
BillWoodruff20-Aug-13 14:57
professionalBillWoodruff20-Aug-13 14:57 
GeneralRe: Treeview node folder images Pin
rfresh20-Aug-13 15:03
rfresh20-Aug-13 15:03 
GeneralRe: Treeview node folder images Pin
BillWoodruff20-Aug-13 15:13
professionalBillWoodruff20-Aug-13 15:13 
GeneralRe: Treeview node folder images Pin
rfresh20-Aug-13 18:09
rfresh20-Aug-13 18:09 
GeneralRe: Treeview node folder images Pin
BillWoodruff21-Aug-13 2:01
professionalBillWoodruff21-Aug-13 2:01 
AnswerRe: Treeview node folder images Pin
Ravi Bhavnani21-Aug-13 7:40
professionalRavi Bhavnani21-Aug-13 7:40 
AnswerRe: Treeview node folder images Pin
SaqibRasheed23-Aug-13 2:19
SaqibRasheed23-Aug-13 2:19 
QuestionChart ToolTip using #VALX as Key of a dictionary Pin
PozzaVecia20-Aug-13 11:43
PozzaVecia20-Aug-13 11:43 
QuestionASP.NET - Dynamic Control ? Or Some other idea ? Pin
Forbiddenx20-Aug-13 9:42
Forbiddenx20-Aug-13 9:42 
SuggestionRe: ASP.NET - Dynamic Control ? Or Some other idea ? Pin
Richard MacCutchan20-Aug-13 20:12
mveRichard MacCutchan20-Aug-13 20:12 
QuestionRetrieve all rows in MySQL stored procedure and put in in C# class. Pin
dudz artiaga20-Aug-13 3:24
dudz artiaga20-Aug-13 3:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.