We have a regular need to calculate a customers selling price based on the cost to them to return a specified gross margin. The mathematically challenged in the office struggle with this so I decided, as you do, to download Visual Basic Express and create a windows application for them to use.
Amazingly, 1 hour later (considering my last programming experience was 25 years ago and only managed to get my name to scroll across the screen) I have it working but the results are showing to 9 decimal places!
The code I have created so far is:
Using 2 text boxes for the input and 1 text box for the result.
How can I get it to return to 2 decimal places? I have seen Format$('n', 'Currency') but no idea how to implement... or is there a better solution?
TIA
Jonty
Amazingly, 1 hour later (considering my last programming experience was 25 years ago and only managed to get my name to scroll across the screen) I have it working but the results are showing to 9 decimal places!
The code I have created so far is:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click RESULTS.Text = Val(COSTPRICE.Text) / Val(1 - (PERCENTAGE.Text / 100)) End Sub
How can I get it to return to 2 decimal places? I have seen Format$('n', 'Currency') but no idea how to implement... or is there a better solution?
TIA
Jonty
Comment