How to conversions of number I loose my significant values.

I have code below that will take a number (0.3346) in inches and convert it back into mm. The top part of the code after I multiply by 25.4 give me (8.4988D) It should suppose to give me 8.50 mm then what I need to do is take that (8.4988D) value and convert it to a nice round number of 8.50.
I thought the code below would do that with using decimal instead of a double type.

Can anyone offer a suggestion?

 Dim number As Decimal
                        number = Me.txtProbeOffset.Text * 25.4
                        Me.txtProbeOffset.Text = number
                        Select Case number
                            Case 0 To 9
                                If Me.txtProbeOffset.Text.Contains(".") Then
                                    GaugeOffset = Me.txtProbeOffset.Text.Replace(".", "")
                                    GaugeOffset = "0" & GaugeOffset & "0"
                                    If GaugeOffset.Length = 5 Then
                                        GaugeOffset = GaugeOffset.Remove(GaugeOffset.Length - 1)
                                    End If
                                Else
                                    GaugeOffset = "0" & Me.txtProbeOffset.Text & "0" & "0"
                                    If GaugeOffset.Length = 5 Then
                                        GaugeOffset = GaugeOffset.TrimEnd("0")
                                    End If
                                End If
                            Case 10 To 99
                                'If Me.txtProbeOffset.Text.Contains(".") Then
                                '    GaugeOffset = Me.txtProbeOffset.Text.Replace(".", "")
                                '    GaugeOffset = GaugeOffset & "0"
                                'Else
                                GaugeOffset = number & "0" & "0"
                                'End If
                            Case Else
                                Me.ErrWarning.SetError(Me.txtProbeOffset, "Value entered must be in a correct format.MAX value is 5 characters.")
                                WirelessGageSetupMode.Text = "Value entered must be in a correct format.MAX value is 5 characters."
                                ConnectionStatus.BackColor = System.Drawing.Color.Yellow
                                Exit Sub
                        End Select

Open in new window

cmdolcetAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
you should use Math.Round (https://msdn.microsoft.com/en-us/library/zy06z30k(v=vs.110).aspx):

number = Math.Round(Me.txtProbeOffset.Text * 25.4, 2)

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.