Round Number to Nearest .99 (ex: 2.00 to 1.99) - Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

The following tutorial will show you how to round a whole number or a decimal to the nearest 99 decimal.

Example 57 to 56.99

Or 23.85 to 23.99

round to nearest 99
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
 Handles Button1.Click
        Dim x As String = TextBox1.Text * 100
        Dim y As String = 10
        Dim z As String
        z = (Math.Round(x / 10) * 10) - 1
        MsgBox(z / 100)
    End Sub

Result:

round to nearest .99


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.