Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Changing currency from $ to Custom Currency symbol and Parsing- VB.NET winforms

$
0
0

Hello guys!

I found a code on MSDN to format currency using CultureInfo i.e

Public Class Form1

    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        'http://msdn.microsoft.com/en-us/library/syy068tk%28v=vs.71%29.aspx
        Dim newCulture As System.Globalization.CultureInfo = System.Globalization.CultureInfo.CurrentUICulture.Clone()
        newCulture.NumberFormat.CurrencySymbol = "Rs "
        newCulture.NumberFormat.CurrencyDecimalDigits = 2

        newCulture.NumberFormat.CurrencyGroupSeparator = ","
        newCulture.NumberFormat.CurrencyDecimalSeparator = "."
        'http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencynegativepattern.aspx
        'etc...

        System.Threading.Thread.CurrentThread.CurrentCulture = newCulture
        System.Threading.Thread.CurrentThread.CurrentUICulture = newCulture


        Dim test As Integer = 1425
        Dim result = test.ToString("C")

    End Sub

End Class
This is working fine. How to pasre the string which is formated using this culture info to get the decimal value back?



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>