UCS_Staff
asked on
How can I specify Euro ¬, Yen ¥, or US $ Currency Symbol to show on a Money data type regardless of the Windows Regional and Language Options
I have a Application in VB.net that is tied to a SQL DB. I can create a view in SQL with various tables which will give me essentially 4 columns. Column 1 is a string data type with "¬" (euro). Column 2 is a money data type let's say with a value of "2.50". Column 3 is a string data type with "¥" (yen). Column 4 is a money data type let's say with a value of "200.15". What I want to do is have the application read Coulmn 2 as "¬2.50" and Column 4 as "¥200.15"
When I view any money data types I always see "$" (dollar) and I know that if I change my Windows Regional and Language Options from English(United States) to Japanese then I can always see "¥" (yen). What I want to do is somehow override or ignore the Regional and Language Options so that I can display the currency symbol that I want.
Will it make a difference if column 2 is always a particular currency type and column 4 is always a particular currency type, versus having anything including "¥" (yen), "¬" a(euro), $(dollar), and £(pound)?
When I view any money data types I always see "$" (dollar) and I know that if I change my Windows Regional and Language Options from English(United States) to Japanese then I can always see "¥" (yen). What I want to do is somehow override or ignore the Regional and Language Options so that I can display the currency symbol that I want.
Will it make a difference if column 2 is always a particular currency type and column 4 is always a particular currency type, versus having anything including "¥" (yen), "¬" a(euro), $(dollar), and £(pound)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
vb.net string concatenation, assuming you have read the values in sCol1 and dCol2
sMergedCol = sCol1 & Convert.ToString(dCol2)
sMergedCol = sCol1 & Convert.ToString(dCol2)
In that t-sql, I think you might need to specify a size on VARCAHAR eg VARCHAR(20). I think you can also use CONVERT. eg CONVERT(VARCHAR(20), col2)
ASKER
Unfortunately I cannot change the data type because of other code using it which will not work if it is changed to a string type.
I forgot to mention I am using a VSFlexgrid on the User Interface to display the SQL data. Is it a vsflex property that i am missing? I hope what i am saying makes sense. In another area where the money/currency data type is used is it possible to make it so no Currency Symbol shows at all?
currency-symbol.JPG
I forgot to mention I am using a VSFlexgrid on the User Interface to display the SQL data. Is it a vsflex property that i am missing? I hope what i am saying makes sense. In another area where the money/currency data type is used is it possible to make it so no Currency Symbol shows at all?
currency-symbol.JPG
ASKER
Just found out the second part of my last post. To make "5.50" with a data type of money read as "5.50" instead of "$5.50" when linking record set to a VSFlex grid i just had to do the following code
Vsf.ColFormat(Col) = "0.00"
ASKER
I think part of my solution is as you pointed out Dhaest. My problem now is the synatx as im pretty new to at this. I found the following parts of code, and there seems to be 2 places where it formats currency but how do i stick the culture info to it? Hopefully i have included all the necessary snippet to show you esentially what i am looking at.
Imports System.Globalization
Public Class Form1
Dim ch As New CultureInfo("zh-CN")
Dim fnCost As String = Schema.Record.Fields.Total_Cost.ToString
Dim summaryBand As UltraGridBand
summaryBand = m_UltraGrid.DisplayLayout.Bands(0)
summaryBand.Columns(fnCost).Format = "c"
If summaryBand.Summaries.Count = 0 Then
summaryBand.Summaries.Add("TAmount", SummaryType.Sum, _ summaryBand.Columns(fnCost), SummaryPosition.UseSummaryPositionColumn)
summaryBand.Summaries.Item("TAmount").DisplayFormat = "{0:c}"
end if
end class
ASKER
Thanks for pointing me in the right direction. Just needed to figure out where to put the CultureInfo
ASKER
Found out where to format the cultureinfo in the comment above. After line 8 add the following code
' ch being the CultureInfo decalred in line 4
summaryBand.Columns(fnCost).FormatInfo = ch
I think you need to change your number column to a string
eg
SELECT COL1 + CAST(COL2 AS VARCHAR) AS VaLUEINEURO
or in vb.net, create a new string yourself using string concatenation