comma which is the seperator?

mo_.net

New member
Joined
Feb 6, 2012
Messages
4
Programming Experience
Beginner
Dear Reader(s)

i ame a beginner in .Net
but for my work i ame involved in the building of a self written solution.

here is the case:

we load data from a Xml script, there it is for example "10.55" or "10.000,55"
here in the netherlands it is not a dot but a comma which is the seperator. so i want to see in my soluation "10,55" and "10.000,55" but when i load everything it is shown at my acces databse as "1055" instead of "10,55".
afther long searching i saw that is was caused because of the diffrent "cultures" and that i need to change my culture info, and so i did, but then it rounds everything off so "10.55" becomes "11.00".

dous somebody know a solution?
thank you in advance!!

With kind Regards Mo_.Net
 
but then it rounds everything off so "10.55" becomes "11.00".
You're going to have to be more specific than "it". If your code doesn't work then your code is wrong. We've never seen your code so we don;t know what's wrong with it.
 
dear jmcilhinney

the problem is that it is actually property of the company, so i cant just copy/paste with it!!!
but, maybe i could explain it more clearly?!


i debugged a little with this:

MsgBox(OrderDetail(23).GetType.IsValueType)
MsgBox(OrderDetail(23).GetType().ToString)

the results said that the fields of "orderDetail(23)" are string but need them to be decimal
just tell me how to change the field type.


Thanks in Advance!!
 
Still too vague. I can't just tell you how to change the field type because I have no idea what OrderDetail is, how it is declared, how it is populated, etc.

the case is simpel



in the XMl file the value of a specific node is "23.00"
the seperator is "."

when it is brought inside into the vb.net and from there to the Acces database, the value of "23.00" is impossible in the Dutch "Culture".
so i need globlization to get the correct value shown.

another example test:

PHP:
MsgBox("total paid real:  " & CDec("11.00"))
       MsgBox("total paid real:  " & CDec("12,00"))

the "11.00" is shown in the MsgBox as "1100"
and the "12,00" is shown in the MsgBox as "12,00"

because it has the correct seperator for the nl-NL culture.
so is this more clear.
could you show me how to make my solution more "Global"


thanks in forward
 
Below a snap of my code and some more information:

The code below gets its data from an XML feed. The XML is parsed with XML reader.
The order details (OrderDetail var) are from a 2nd XML feed. The values in this array are all of the type string

OrderDetail(23) has a value with a decimal point in it representing the total_paid C data element (so since it is C DATA it is a string) from the order detail XML feed.

Our local PC's use a , (comma) as decimal and not a . (point/dot)

Since this is an application that has to be working on both Dutch, US, UK and german localisation we need to convert this type?

When using Ctype or Cdec to cast for example 10.11 the result is 1011, when using 10,11 the result is 10,11 as it should be.

just for the record, the code has to be stored in an access database.


VB.NET:
While reader.Read()

Dim node = reader.Name
If reader.NodeType = XmlNodeType.Element Then
If node = "order" Then
Dim OrderId = reader.GetAttribute("id")
'MsgBox("orderid " & OrderId & "datum" & OrderSummary(0))
If OrderId > 0 Then
Dim OrderDetail = Order.getOrderDetail(OrderId)
' store order details in local database
Dim OrderRow As DataRow
OrderRow = PrestaSyncDataSet.orders.NewRow()


OrderRow.Item("id") = OrderId
OrderRow.Item("date_add") = OrderDetail(15)
OrderRow.Item("date_upd") = OrderDetail(16)
OrderRow.Item("payment") = OrderDetail(18)

OrderRow.Item("total_discounts") = OrderDetail(22)

OrderRow.Item("total_paid") = OrderDetail(23)
MsgBox("total paid real: " & CDec("11.00")) 'returns 1100
MsgBox("total paid real: " & CDec("12,00")) 'returns 12,00
OrderRow.Item("total_paid_real") = CDec(OrderDetail(24))


'MSGBOXES
'MsgBox("test " & OrderDetail(22).GetType.IsValueType) 'Gets a value indicating whether the Type is a value type.
'MsgBox("what thype is it? " & OrderDetail(22).GetType().ToString)
'MSGBOXES

'OrderRow.Item("total_products") = OrderDetail(25)
'OrderRow.Item("total_shipping") = OrderDetail(27)
'OrderRow.Item("carrier_tax_rate") = OrderDetail(28)
'OrderRow.Item("conversion_rate") = OrderDetail(31)
PrestaSyncDataSet.orders.Rows.Add(OrderRow)
OrdersTableAdapter.Update(PrestaSyncDataSet.orders)

End If
End If
End If

End While
 
Back
Top