Free for PREMIUM members
[Webinar] Streamline your web hosting managementRegister Today
string CtlName = "txtPasskey";
Control matches = this.Controls.Find(CtlName, true);
if (matches.Length > 0)
// ... do something with matches ...
if (matches is TextBox)
TextBox tb = (TextBox)matches;
tb.Text = "You found me!";
Open in new window
private TextBox GetTextBox()
TextBox txtPasskey = new TextBox();
txtPasskey.Name = "txtPasskey";
txtPasskey.MaxLength = 8;
txtPasskey.PasswordChar = '*';
txtPasskey.TextAlign = HorizontalAlignment.Left;
txtPasskey.Location = new Point(200, 200);
txtPasskey.TextChanged += new EventHandler(this.txtPasskey_TextChanged);
txtPasskey.Validating += new CancelEventHandler(this.txtPasskey_Validating);
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $389.00.
Premium members get this course for $159.20.
Premium members get this course for $37.50.
Premium members get this course for $143.20.