Multiplying
Post your questions regarding programming in C# in here.
3 posts
Page 1 of 1
Hello,
I need to multiply 2 numbers. The first is a Quantity the second is thr price and i want the result in the fild Total. Once i type those numbers i need to calculate without pressing any button only by leaving the field. How can i do?
And then i would like to calculate subtotal, any % of that subtotal and then get the total.
C#
I need to multiply 2 numbers. The first is a Quantity the second is thr price and i want the result in the fild Total. Once i type those numbers i need to calculate without pressing any button only by leaving the field. How can i do?
And then i would like to calculate subtotal, any % of that subtotal and then get the total.
C#
In a field, do you mean TextBox? You could calculate each time the text changes:
Code: Select all
private void TextBox_TextChanged(object sender, System.EventArgs e)
{
int x = 0;
int y = 0;
int.TryParse(textBox1.Text, out x);
int.TryParse(textBox2.Text, out y);
textBox3.Text = (x * y).ToString();
//Here is how to get 35% of the total. To get 12%, replace 0.35 with 0.12. 6% = 0.06
textBox4.Text = (x * y * 0.35).ToString();
}
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
You should be using a ulong so most if not all number's will work fine.
If they could contain decimals you the decimal data type.
If they could contain decimals you the decimal data type.
Bound and boom tech,
The Future Of Coding
The Future Of Coding
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023