3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by hassan12345
0

Hi MaiHunDown, welcome here!
Rather strange question.
What do you mean?
A TextBox has a Click or MouseClick event.
Do you want to show some info in a textbox after clicking a button?

0

Yes I want to show some info in a textbox after clicking a button.

Thanks

2

In the Click event of a button you could set the Text property of your TextBox.
Like so:

private void button1_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "Hello world!";
        }
Votes + Comments
Helpful, to the point :)
0

Plz help
There aren two button and one textBox in a form.I want to show information in textBox when I click 1st button info is showing in texBox but when I click 2nd button the earlier text from textBox is going unvisible or erase?, I don't want it to erase.

0

Then do it like this:

this.textBox1.Text += "Hello world!";

or

this.textBox1.Text = this.textBox1.Text + "Hello world!";

The plus operator will append your new string to the textstring already in the textbox.

0

Check this code i hope its solve your problem

private void button1_Click(object sender, EventArgs e)
      {
     textBox1.AppendText("I Love Allah!");
      }

 private void button2_Click(object sender, EventArgs e)
      {
      textBox1.AppendText("I Love Islam!");
      }

Edited by Nick Evan: added code-tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.