// The following is a validation condition that prevents users to enter more than 3 characters private void textBox1_Validating(object sender, CancelEventArgs e){ if (textBox1.Text.Length > 3) { MessageBox.Show("Length exceeds 3 characters"); e.Cancel = true; }}
// You can surpass the above validation condition on assigning a calculated value for textBox1.textBox1.Enabled = false;this.ValidateChildren(ValidationConstraints.Enabled);textBox1.Text = "abcd" + "1234";