I did a little more coding and came up with how I wanted to use this, but it throws a bunch of exceptions at me, even though the code works fine.
The exceptions:Code:totalPriceString = totalPrice.ToString Dim priceArray() = totalPriceString.Split("."c) If ((priceArray IsNot Nothing) And (UBound(priceArray) = 0)) Then ' I have no decimals totalPriceString = totalPrice.ToString & ".00" salesTaxString = salesTax.ToString & ".00" ElseIf ((priceArray IsNot Nothing) And (UBound(priceArray) = 1)) Then ' I have one or two decimals already If (priceArray(1).Length = 1) Then totalPriceString = totalPrice.ToString & "0" salesTaxString = salesTax.ToString & "0" End If End If
I understand what the exceptions mean, just not why I am getting them in this case when I specifically checked to prevent them...Code:A first chance exception of type 'System.IndexOutOfRangeException' occurred A first chance exception of type 'System.NullReferenceException' occurred A first chance exception of type 'System.NullReferenceException' occurred A first chance exception of type 'System.NullReferenceException' occurred A first chance exception of type 'System.NullReferenceException' occurred A first chance exception of type 'System.NullReferenceException' occurred A first chance exception of type 'System.IndexOutOfRangeException' occurred A first chance exception of type 'System.IndexOutOfRangeException' occurred A first chance exception of type 'System.IndexOutOfRangeException' occurred A first chance exception of type 'System.IndexOutOfRangeException' occurred




Reply With Quote