货币格式与货币

时间:2016-02-17 03:22:29

标签: sql-server vb.net

我需要让它看起来像¥65,826.00自动。并接受其他货币

Private Sub acquisitioncost_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles acquisitioncost.LostFocus
    Dim dec As Decimal
    If Decimal.TryParse(acquisitioncost.Text, System.Globalization.NumberStyles.Currency, Nothing, dec) Then
        acquisitioncost.Text = dec.ToString("C")
    End
End Sub

1 个答案:

答案 0 :(得分:0)

   Dim dec As Decimal
        If Decimal.TryParse(acquisitioncost.Text, System.Globalization.NumberStyles.Currency, Nothing, dec) Then
            'acquisitioncost.Text = String.Format("{0:C}".Remove(0, 1), dec)
            If curcmb.Text = "JPY" Then
                acquisitioncost.Text = dec.ToString("C", CultureInfo.CreateSpecificCulture("ja-JP"))
            ElseIf curcmb.Text = "GBP" Then
                acquisitioncost.Text = dec.ToString("C", CultureInfo.CreateSpecificCulture("en-GB"))
            ElseIf curcmb.Text = "PHP" Then
                acquisitioncost.Text = dec.ToString("C", CultureInfo.CreateSpecificCulture("fil-PH"))
            ElseIf curcmb.Text = "USD" Then
                acquisitioncost.Text = dec.ToString("C", CultureInfo.CreateSpecificCulture("en-US"))
            ElseIf curcmb.Text = "EUR" Then
                acquisitioncost.Text = dec.ToString("C", CultureInfo.CreateSpecificCulture("de-DE"))
            Else
                acquisitioncost.Text = dec.ToString("C").Remove(0, 1)

            End If


            'acquisitioncost.Text = dec.String.Format("{0:C}", price)
        End If