0

In visual basic 2010 my default is dollar sign "$". How can I change the default currency of mine country which is Malaysia with a sign of "RM". Thanks in advance.

*EDIT

Basically when I entered these code, it doesn't work. Can I know why?

Private Sub Button1_Click ......

Dim a As Integer = 400

Dim ri As System.Globalization.RegionInfo = New System.Globalization.RegionInfo(New CultureInfo("ms-MY").LCID)

Console.WriteLine(ri.CurrencySymbol)

MsgBox(a.ToString("C"))

End Sub

YYee
  • 1
  • 1
  • 3

2 Answers2

0

You should try setting the culture of your thread or get info for a relevant thread. Using this way you can retrieve culture specific currency code.

**EDIT: **

var ri = new System.Globalization.RegionInfo(new CultureInfo("ms-MY").LCID);
Console.WriteLine(ri.CurrencySymbol);  // Output `RM`

Have a look at this url for list of culture supported.

EDIT : (VB.Net version)

Dim ri as System.Globalization.RegionInfo = new System.Globalization.RegionInfo(new CultureInfo("ms-MY").LCID)
Console.WriteLine(ri.CurrencySymbol)  // Output `RM`
Community
  • 1
  • 1
NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
  • Sorry but could I know where to set the culture of my thread, I am a beginner in using visual basic. I get the code from the side but I don't know where should I type. – YYee Mar 21 '14 at 13:23
  • @user3425675 Check the code and - cough - the documentation ;) – TomTom Mar 21 '14 at 16:15
  • Can I have the code for visual basic rather than code for C# cause I don't know any thing about the C# language. Thanks. – YYee Mar 22 '14 at 02:41
0

This caught my eye and I thought to provide this solution. To make the CultureInfo class work in Visual Basic you'll need code like this:

Imports System.Globalization

Public Class .......

Private Sub Button1_Click ......
Dim a As Integer = 400
Dim ri As CulturInfo = New CultureInfo("ms-MY")

MsgBox(a.ToString("C",ri))

End Sub
End Class