473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

English Numbers - Different Language Settings

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
Nov 21 '05 #1
5 1564
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
Nov 21 '05 #2
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

"Cor Ligthert" wrote:
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

Nov 21 '05 #3
"Jack" <Ja**@discussions.microsoft.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
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
Nov 21 '05 #5
Thanks all for your help. The advice received here is quite helpful!
"Jack" wrote:
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

"Cor Ligthert" wrote:
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

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: smjmitchell | last post by:
Hi, I am writing an application in VB6.0 that will have the option to select the language. For instance when Spanish is selected all the text on the program interface will display in Spanish. ...
3
by: F. GEIGER | last post by:
When I start a py2exe-ed application I get the error 'ascii' codec can't encode character u'\xe9' in position 10: ordinal not in range(128) This is how I run py2exe: setup.py py2exe -O1...
2
by: Sura | last post by:
Hi I am trying to make a website in different languages. Can anyone help me, as in what steps I need to take and what extra codes I need to write. Thanks Sura
18
by: OrenFlekser | last post by:
Hi I've posted this message couple of days ago, but I can't find it now, so sorry if you see it twice... Anyways - I have a text box, and I want my users to be able to write only in english...
14
by: Gidi | last post by:
Hi, For the last week, i'm looking for a way to make a TextBox always write in English (No matter what the OS default language is). i asked here few times but the answers i got didn't help me. i...
2
by: Marcel Saucier | last post by:
Hi Everybody, At run time, regardless of the computer regional settings, is there a simple way of swtiching the DateTime Picker in French (fr-CA) or in English (en-US) depending of the user...
12
by: Steve Howell | last post by:
The never-ending debate about PEP 3131 got me thinking about natural languages with respect to Python, and I have a bunch of mostly simple observations (some factual, some anecdotal). I present...
1
by: clai83 | last post by:
(A) I am making a web application that needs to work in both an English/Japanese environment. This web application is intended to manage a company website (news releases, add new companies), and...
6
by: Ole Nielsby | last post by:
Does C++ have a method of retrieving this? When launching my app, I want to select the appropriate language for ts GUI, based on the user's language setting. The frameworks wxWidgets and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.