Hi!
I wrote these codes and work well. What I am doing first before to explain what I need.
As you can see when I put number minus to 5 it's should display a message. For that I do use three textboxes. Two textboxes to put number and the thirth one where the message should appear if the number its minus than 5.
But my big problem is. How can I can use decimal number using textboxes as this:
decimal d1, d2, total;
decimal.TryParse(txtBox1.Text, out d1);
decimal.TryParse(txtBox2.Text, out d2);
total = d1 - d2;
txtBox3.Text = total.ToString("N");
But the real code is:
private void txtBox3_TextChanged(object sender, EventArgs e)
{
string s = (sender as TextBox).Text;
int i = Convert.ToInt16(s);
if (i < 5)
{
MessageBox.Show("The stock is minimum. Thanx!");
(sender as TextBox).Focus();
}
}
5 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manas MohapatraPosted Nov 3, 2016, 1:26 PM
Amit GuptaPosted Nov 3, 2016, 11:58 AM
IsraelPosted Nov 3, 2016, 11:45 AM
IsraelPosted Oct 15, 2016, 11:34 AM
Delpin Susai RajPosted Oct 15, 2016, 8:23 AM