Israel

Israel

  • NA
  • 1.3k
  • 204.2k

Using a textBox for alert

Apr 26 2016 10:54 AM
Hi!
 
I would like to make a textbox alerting when I make an operation. These codes work well. But I need to use a Textbox to boot an alert.
 
private void textBox3_TextChanged(object sender, EventArgs e)
{
string s = (sender as TextBox).Text;
int i = Convert.ToInt16(s);
if (i > 5)
{
MessageBox.Show("Number greater than 5");
(sender as TextBox).Focus();
}
}
 
For instance, TextBox1.Text + TextBox2.Text = TextBox3.Text //If the answer its more than five (5). Then popup the message.
 

Answers (6)