Text is a property with many meanings. The Text property is available on various Windows Forms controls, including the Form and the TextBox. You can get and set this property to change the string that stores the text for the control. Controls implement Text differently.
This C# example program demonstrates the Text property in Windows Forms.

In this example program, we use a TextBox as well the default Form. For more information about these controls, please see the appropriate articles. We assign the Text property of the enclosing Form (this) and the TextBox instance (textBox1).
TextBox Tutorial Form: Event HandlersProgram that uses Text property [C#]
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Form has a Text property.
this.Text = "Dot Net Perls";
// TextBox has a Text property.
textBox1.Text = "Thanks";
}
}
}
Result
See screenshot.
Results. You can see the results of this program in the screenshot. The title bar text of the window has its text changed to "Dot Net Perls", while the TextBox contains the string "Thanks". You can see that the Text property is implemented in a different way on the Form and TextBox.
String LiteralKnowing how to use the Text property on a Form (as with this.Text) is confusing because we often don't think of the title bar as text. Additionally, the Text property becomes even more confusing when other controls like TextBox implement it an entirely different way.
Windows Forms