Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal Places within a Label

Status
Not open for further replies.

Drofder2004

Technical User
Jan 3, 2005
10
GB
I have a small amount of code for a very basic set of calculations, I just need to make a label limit to only 2 decimal places after a calculation has been done. "lblG" is the label needing the decimal limit.

this is my code if it is needed...

Private Sub cmdgo_Click()

'Make Variables
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As String


'Link Variables to form
A = txtA.Value
B = txtB.Value
C = txtC.Value
D = txtD.Value

'Arithmatic
lblA.Caption = "£" & (A * 0.45)
lblB.Caption = "£" & (B * 0.45)
lblC.Caption = "£" & (C * 0.45)
lblD.Caption = (A + B + C)
lblE.Caption = "£" & (A * 0.45) + (B * 0.45) + (C * 0.45)
lblF.Caption = "£" & (A * 0.45) + (B * 0.45) + (C * 0.45) + D
lblG.Caption = lblF.Caption / 0.45

End Sub

Thanks for any help...
 
lblG.Caption = FormatNumber((lblF.Caption / 0.45),2)

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top