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 DuranoPosted Apr 27, 2016, 2:01 PM
IsraelPosted Apr 27, 2016, 7:14 AM
Upendra Pratap ShahiPosted Apr 27, 2016, 6:22 AM
IsraelPosted Apr 27, 2016, 6:15 AM
Upendra Pratap ShahiPosted Apr 26, 2016, 1:06 PM
Amit KumarPosted Apr 26, 2016, 12:53 PM
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
}
}