Hi
i have 10 textbox in mu win form
iwant insert data from this 10 textbox to one textbox
how do it?
thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit ChoudharyPosted Feb 10, 2011, 5:51 AM
Little enhancement to the above code give by Micke.
foreach(Control ctl in Form.Controls)
{
if(ctl is TextBox)
{
sb.Append(((TextBox)ctl).Text);
}
}
txtBox_all_together.Text = sb.ToString();
Hope it helps you.
Please mark the "Do you like this post" if it helps you.
Micke BlomqvistPosted Feb 10, 2011, 3:25 AM
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(txtBox1.Text);
sb.Append(txtBox2.Text);
sb.Append(txtBox3.Text);
sb.Append(txtBox4.Text);
sb.Append(txtBox5.Text);
sb.Append(txtBox6.Text);
sb.Append(txtBox7.Text);
sb.Append(txtBox8.Text);
sb.Append(txtBox9.Text);
sb.Append(txtBox10.Text);
txtBox_all_together.Text = sb.ToString();