Convert a currency string to a double- VB.NET
Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013
There are situations where you need to convert a string shown in a currency format such as $108.99 to a double (108.99). The reason you want to retrieve the amount from the currency string is to do some calculations such as addition or subtraction.
Private Sub Button1_Click(sender As System.Object, _ e As System.EventArgs) Handles Button1.Click Dim currencyTxt As Double = Double.Parse(TextBox1.Text, _ Globalization.NumberStyles.Currency) TextBox2.Text = currencyTxt End Sub
The above method works also with a negative number that is displayed between two parantheses: