In this example, I’ll show you How to concatenate multiple textboxes values in C# Windows Form Application.
Concatenate Two Textbox into an Another Textbox
C# Code (Button1_Click)
1 2 3 4 5 6 7 8 9 |
private void button1_Click(object sender, EventArgs e) { string msg = "Hello."; string fName = textBox1.Text; string lName = textBox2.Text; textBox3.Text = msg + " "+fName +" "+ lName; } |
Output:
Concatenate Two Textbox into Label
C# Code (Button1_Click)
1 2 3 4 5 6 7 8 9 |
private void button1_Click(object sender, EventArgs e) { string msg = "Hello."; string fName = textBox1.Text; string lName = textBox2.Text; label4.Text = msg + " "+fName +" "+ lName; } |
Output:
Concatenate Two Textbox into ListBox
C# Code (Button1_Click)
1 2 3 4 5 6 7 8 9 |
private void button1_Click(object sender, EventArgs e) { string msg = "Hello."; string fName = textBox1.Text; string lName = textBox2.Text; listBox1.Items.Add(msg + " "+fName +" "+ lName); } |
Output: