Hello!

i need some help, i just want to round off my textbox value into two decimal places,

here is my code

  Private Sub txtMonthly_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMonthly.TextChanged, txtSemi.TextChanged

    If String.IsNullOrEmpty(txtMonthly.Text) OrElse String.IsNullOrEmpty(txtSemi.Text) Then Exit Sub
    If Not IsNumeric(txtMonthly.Text) OrElse Not IsNumeric(txtSemi.Text) Then Exit Sub
    txtSemiMonthly.Text = CDbl(txtMonthly.Text) / CDbl(txtSemi.Text)

End Sub

i have txtmothly and txtDaily if i put a value in the txtmonthly then the txtdaily will automatically have a value but the value was not in roundoff format..

Math.Round(2.435, 2)    - result is 2.44
Math.Round(2.445, 2)    - result is 2.44

The second parameter is the number of decimal places. Note that if you want to consistently round up if the digit is 5 then you must do

Math.Round(2.445 + 0.005, 2)