Wednesday, October 11, 2017

ตัวอย่างการใช้ Decimal.TryParse, Leave

Private Sub txtEstimateAmount_Leave(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles txtEstimateAmount.Leave

    ' Take any dollars-and-cents amount and round to the nearest dollar
    Dim est As Decimal
    est = Decimal.TryParse(txtEstimateAmount.Text.Trim, est)
    txtEstimateAmount.Text = If(est <> 0, Math.Round(est).ToString(), String.Empty)

End Sub

No comments:

Post a Comment