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.

Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Apr 27, 2016, 10:01 AM EDT
Amit KumarRank #459 · 5.4K reputationPosted Apr 26, 2016, 8:53 AM EDT
if (String.IsNullOrEmpty(textBox1.Text))
{
if (MessageBox.Show("Are you sure you want to close the form?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
e.Cancel = true;
}
else
{
if (MessageBox.Show("You want to save data or not?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
{
//Save data
}
}
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Apr 26, 2016, 9:06 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Apr 27, 2016, 2:15 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Apr 27, 2016, 2:22 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Apr 27, 2016, 3:14 AM EDT