0

i want to build an application that automatically floods a text box with text from another text box on button click. i dont even know where to begin

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by TheForeRunner
Featured Replies
  • Okay, as I just stated, simply add Environment.NewLine to the end of the statement. [code]private void Button_Click(object sender, EventArgs e) { textBox2.Multiline = true; timer1.Start(); } private void Timer_Tick(object sender, EventArgs e) { textBox2.Text += textBox1.Text + Environment.NewLine; }[/code] Read More

0

You can use a timer. Put a button on your form and trigger the button_click event for it. Create a timer and trigger the timer_tick event. In the button_click event start the timer. In the timer_tick event use compound assignment operator += to assign and add the text from one text box to the other.

private void Button_Click(object sender, EventArgs e)
{
timer1.Start();
}

private void Timer_Tick(object sender, EventArgs e)
{
textBox2.Text += textBox1.Text;
}

To add a new line each time on top of the text, just add + Environment.NewLine to the end of the statement. But unless you're using a richtextbox make sure you set the Multiline property of your textbox to true.

Edited by lxXTaCoXxl: n/a

1

Okay, as I just stated, simply add Environment.NewLine to the end of the statement.

private void Button_Click(object sender, EventArgs e)
{
textBox2.Multiline = true;
timer1.Start();
}

private void Timer_Tick(object sender, EventArgs e)
{
textBox2.Text += textBox1.Text + Environment.NewLine;
}
This question has already been answered. 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.