I’m fairly new to C# so i’m having problems understanding calculations in C#.
Firstly, my products that i want to sell, are in a tab page in a tabcontrol.
A checkbox and numeric up down is used to indicate the quantity and whether or not to add to my shopping cart, which is in another tabpage. The adding of items to shopping cart is by a button.
How do i write the codes where the quantity (numeric up down) * the price equals the total?
I have to do this for several products.
I still don’t really understand float, decimal etc. So this is really a headache to me.
Btw i’m doing this on windows form
The decimal keyword indicates a 128-bit data type, it has more precision and a smaller range, which makes it appropriate for financial and monetary calculations.
You want to have a look at event changes in Winforms:
Note Quantity_TextChanged is an event that will be fired when the control named Quantity is changed, your value may be different and will have to be adjusted accordingly. This also applies to the Price control which should be located on your tab control.
http://msdn.microsoft.com/en-us/library/364x0z75(v=vs.100).aspx