Decimal separator

  • Thread starter Thread starter T.K Kullervo
  • Start date Start date
T

T.K Kullervo

Hi, is there someway to change the regional settings--> numbers--> decimal
separator for the the program im creating. I dont want to change it
permanently but my program doesnt work if the separator is a comma.
 
Thats what i meant, how can i change the program to use dots as decimal
separators instead of commas if the regional settings decimal separator is
selected as a comma.
 
you need to study then System.Globalization - namespace. In Msdn you will
find the possibility to set your prefered Culture.
To get the current separator:

Dim DecimalSeparator As Char =
System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSe
parator

Alfred M.

T.K Kullervo said:
Thats what i meant, how can i change the program to use dots as decimal
separators instead of commas if the regional settings decimal separator is
selected as a comma.
 
Can you describe that better, what does not work, normaly it has to do
everything automatic
(The only strange thing I know now is that the culture settings in Net 1.1
on W'98/Me stystems not are set by culture but by keyboard settings)
 
The program is used to send values to another program, which runs on the
command prompt. The sent values are either selected by the user from
numericupdowns or straight from an excel sheet. Then the cmd-program makes
calculations based on the values sent to it.

Private Sub StreamInput(ByVal strText As String)
m_Process.StandardInput.WriteLine(strText)

m_Process.StandardInput.Flush()

End Sub

This is the code used to send the values to the console program. Ive tried
strText.replace(",","."). The Program works fine when the
regional-options-->decimal symbol is set to ".",but when it is "," it doesnt
work
 
Thats what i meant, how can i change the program to use dots as decimal
separators instead of commas if the regional settings decimal separator is
selected as a comma.

Why don't you design your app to work correctly regardless of the
decimal separator selected instead? Ignoring the user's settings tends
to just cause confusion.



Mattias
 
TK
Don't see the culture elements a string is just a string
Did you do
strText.replace(",",".") ' does nothing
or
strText = strText.replace(",",".")
Cor
 
strText = strText.replace(",","."). I dont know what the problem is, maeby
its with the other program. All i know is that the whole system works when
the decimal symbol is set to dot and it doesnt work when its set comma. I
put a textbox on the form and checked out the values sent. The values sent
from my program are like 3.45 not 3,45.
 
There are a number of numericupdowns which values are set to
InputStrings(12) and they are run from a loop to the StreamInput. Thank you
for your interest and help but im afraid i have to bypass this problem for
now, because i have more urgent things to solve. I know it would probably
help if i put more of the code for you to read, but im afraid thats not
possible. Thanks again
 
Back
Top