Here is an complete example: Just copy to a new WindowsForms project and replace Program.cs content with following:
using System;
using System.Windows.Forms;
namespace ClearTextbox
{
static class Program
{
static void Main()
{
Form form = new Form();
TextBox textbox = new TextBox();
textbox.Dock = DockStyle.Top;
textbox.Text = "Clear me!";
Button buttonClear = new Button();
buttonClear.Text = "Clear";
buttonClear.Dock = DockStyle.Top;
buttonClear.Click += delegate(object sender, EventArgs e)
{
textbox.Clear();
};
form.Controls.Add(buttonClear);
form.Controls.Add(textbox);
Application.Run(form);
}
}
}