English Numbers - Different Language Settings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a VB.NET application that will be distributed in the US as well as
many European countries. It uses an xml database with number values, that are
stored as text, that are all in English formats. There are no commas so the
period as a decimal placeholder is all that I'm concerned about with regard
to the various language settings on users machines.

In VB6, wrapping values pulled from the database in the VAL function worked
fine for all the language settings I need to support. Although I know I can
still do this in .NET, I want to make sure I implement this functionality
using the best coding practices.

Any advice that can provided would be greatly appreciated!

Thanks.
Jack
 
Jack,

I made a sample for you.

I have this XML dataset file.

\\\
<?xml version="1.0" standalone="yes" ?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table1">
<xs:complexType>
<xs:sequence>
<xs:element name="DateTime" type="xs:dateTime" minOccurs="0" />
<xs:element name="Money" type="xs:decimal" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<Table1>
<DateTime>2005-02-11T14:47:01.2656250+01:00</DateTime>
<Money>10.00</Money>
</Table1>
</NewDataSet>
///
\\\
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As New DataSet
ds.ReadXml("c:\whatever.xml")
DataGrid1.DataSource = ds.Tables(0)
End Sub
///
It shows me
the date in the grid as
11-02-2005
and the money
10,00

I hope this helps?

Cor
 
Thanks, but the issue is more along the lines of the example below. Do I
still use VAL in .NET or is there a more appropriate way to do this?

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim xmlDollarValue As Xml.XmlElement
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("C:\whatever.xml")
xmlDollarValue =
xmlDoc.DocumentElement.SelectSingleNode("Table1/Money")
Me.TextBox1.Text = Convert.ToDecimal(xmlDollarValue.InnerText)
Me.TextBox2.Text = Convert.ToDecimal(Val(xmlDollarValue.InnerText))
End Sub
 
Jack said:
Thanks, but the issue is more along the lines of the example below. Do I
still use VAL in .NET or is there a more appropriate way to do this?

Yes, you can still use 'Val' if it fits your need. In some cases, using a
datatype's 'Parse' method with
'System.Globalization.CultureInfo.InvariantCulture' might be more
appropriate.
 
Jack,

In my opinion is the goal to make everything as much globalize inside the
standards.

As an Aussie has told a while ago in this newsgroup does his company not use
US software anymore because of the culture problems with those (that was
about dates).

Microsoft has done for that a good job, although I find the RESX files a
disaster, is the rest in my opinion very well done for the moment.

In my idea should you try to get it as globalized as possible and ban those
hard formated string (I assume that is what you mean with text). Those
values in strings will most probably break you up one time.

Just my thought,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top