1: 2: 3: 4: 5: 6: 7: 8: 9:
richTextBox1.KeyPress += new KeyPressEventHandler(richTextBox1_KeyPress); ... void richTextBox1_KeyPress(object sender, KeyPressEventArgs e) { if (richTextBox1.Text.Length > 256) e.Handled = true; }