Look at it step by step.

First, get the integer portion. Ok, that's easy

`Dim intPortion As Long = Math.Truncate(Value)`

Now, get the decimal portion with the number of digits that you want.

`Dim decimalPortion As Long = Math.Truncate((Value - intPortion) * Math.Pow(10, NumberOfDecimals))`

Now return the integer portion plus the decimal portion converting the decimal portion back into a decimal.

`Return intPortion + (decimalPortion / Math.Pow(10, NumberOfDecimals))`

If you are doing math, you shouldn't use strings at all...there's no need to.

Also, if your intent is to return "16.90" if you want 2 digits, then you need to return a string, not a double.

Anyway, my way put together looks like:

```
Private Function Truncate(ByVal Value As Double, Optional ByVal NumberOfDecimals As Integer = 0) As Double
Dim intPortion As Long = Math.Truncate(Value)
Dim decimalPortion As Long = Math.Truncate((Value - intPortion) * Math.Pow(10, NumberOfDecimals))
Return intPortion + (decimalPortion / Math.Pow(10, NumberOfDecimals))
End Function
```

Just as an FYI...the better, more concise way would be one line of code:

```
Return (Math.Truncate(Value * Math.Pow(10, NumberOfDecimals)) _
/ Math.Pow(10, NumberOfDecimals))
```

...at least mathematically. For some reason, the

`Value * Math.Pow(10, NumberOfDecimals)`

also returns 16.89 when 16.9 is the value and NumberOfDecimals is 2.