private void Button1_Click(System.Object sender, System.EventArgs e) { //create a variable that represents the control. Control txt = default(Control); //After that, Loop the control that you have created. foreach (Control tempLoopVar_txt in this.Controls) { //Then, check if the type of the control is a Textbox and if it’s true, then perform the process that puts the name of the TextBox to itself. Do this code inside the Loop. txt = tempLoopVar_txt; { txt.Text = txt.Name; } } }