hi .. I have done coding for calculation ... but the results obtained (eg.13.9484736273928) .. how can I get the results in 2 decimal point (eg 13.95)?

Your help is greatly appreciated

Private Sub tx_kh2_Change()
Text2.Text = Now()
Dim x As Integer

x = DateTime.DateDiff("s", Text1.Text, Text2.Text)


Text3.Text = x
Text4.Text = (20 / x) / 27.7778

Recommended Answers

All 3 Replies

Perhaps...
FormatNumber Function
specifically the second (first optional) parameter, NumDigitsAfterDecimal.

This is the last line of your answer
Text4.Text = (20 / x) / 27.7778
Try like this, it should work as you require
Text4.Text = Format((20 / x) / 27.7778, "###,###,##0.00")

OR
Text4.text = Format(13.9484736273928, "###,###,##0.00")

OR
Text4.text = Format(Text4.text, "###,###,##0.00")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.