473,480 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cdbl & International Settings

Hi, I have a problem with two function: IsNumber() and CDbl() because when I
invoke it they throw an exception.
The problem I think is International Settings, because
NumberDecimalSeparator and NumberDecimalGroup have the same value "."
I can't change this setting on computer by default so what I want to know if
I can change this settings only for my application.

I've used System.Globalization but CDbl use the settings in contro pannel.

Thanks in advice

Feb 10 '06 #1
6 3597
Hello michelle,

Use system.globalization.cultureinfo.currentculture.nu mberformat.numberdecimalseparator and numbergroupseparator to indicate the separators you want.
Instead of CDbl, use Double.Parse, which uses current thread culture information.

Regards.
"michele" <mi***********@unipr.it> escribió en el mensaje news:%2****************@TK2MSFTNGP14.phx.gbl...
| Hi, I have a problem with two function: IsNumber() and CDbl() because when I
| invoke it they throw an exception.
| The problem I think is International Settings, because
| NumberDecimalSeparator and NumberDecimalGroup have the same value "."
| I can't change this setting on computer by default so what I want to know if
| I can change this settings only for my application.
|
| I've used System.Globalization but CDbl use the settings in contro pannel.
|
| Thanks in advice

Feb 10 '06 #2
Thank you, in fact I've used it and I thought that all was ok but I
discovered that I used I PrintDocument that involved "International
Settings" and I've the applicationt runs ok but I can't print because I
don't know how to set enviroment to PrintDocument.

"José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
news:uA****************@TK2MSFTNGP12.phx.gbl...
Hello michelle,

Use
system.globalization.cultureinfo.currentculture.nu mberformat.numberdecimalseparator
and numbergroupseparator to indicate the separators you want.
Instead of CDbl, use Double.Parse, which uses current thread culture
information.

Regards.
"michele" <mi***********@unipr.it> escribió en el mensaje
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Hi, I have a problem with two function: IsNumber() and CDbl() because when
I
| invoke it they throw an exception.
| The problem I think is International Settings, because
| NumberDecimalSeparator and NumberDecimalGroup have the same value "."
| I can't change this setting on computer by default so what I want to know
if
| I can change this settings only for my application.
|
| I've used System.Globalization but CDbl use the settings in contro pannel.
|
| Thanks in advice
Feb 10 '06 #3
I don't understand the problem. The PrintPage event runs on the same thread on which you call PrintDocument.Print, so it uses the same environment.

Regards.
"michele" <mi*****@zenna.it> escribió en el mensaje news:OR**************@TK2MSFTNGP11.phx.gbl...
| Thank you, in fact I've used it and I thought that all was ok but I
| discovered that I used I PrintDocument that involved "International
| Settings" and I've the applicationt runs ok but I can't print because I
| don't know how to set enviroment to PrintDocument.
|
| "José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
| news:uA****************@TK2MSFTNGP12.phx.gbl...
| Hello michelle,
|
| Use
| system.globalization.cultureinfo.currentculture.nu mberformat.numberdecimalseparator
| and numbergroupseparator to indicate the separators you want.
| Instead of CDbl, use Double.Parse, which uses current thread culture
| information.
|
| Regards.
|
|
| "michele" <mi***********@unipr.it> escribió en el mensaje
| news:%2****************@TK2MSFTNGP14.phx.gbl...
|| Hi, I have a problem with two function: IsNumber() and CDbl() because when
| I
|| invoke it they throw an exception.
|| The problem I think is International Settings, because
|| NumberDecimalSeparator and NumberDecimalGroup have the same value "."
|| I can't change this setting on computer by default so what I want to know
| if
|| I can change this settings only for my application.
||
|| I've used System.Globalization but CDbl use the settings in contro pannel.
||
|| Thanks in advice

Feb 11 '06 #4
Ok, maybe I missunderstand how to program so can you explain more, it it is
possible.
I've tried to use
System.Globalization.Cultureinfo.Currentculture.Nu mberformat.NumberDecimalSeparator
= ","
but this property is red-only..

Thanks
"José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
news:eQ**************@TK2MSFTNGP10.phx.gbl...
I don't understand the problem. The PrintPage event runs on the same thread
on which you call PrintDocument.Print, so it uses the same environment.

Regards.
"michele" <mi*****@zenna.it> escribió en el mensaje
news:OR**************@TK2MSFTNGP11.phx.gbl...
| Thank you, in fact I've used it and I thought that all was ok but I
| discovered that I used I PrintDocument that involved "International
| Settings" and I've the applicationt runs ok but I can't print because I
| don't know how to set enviroment to PrintDocument.
|
| "José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
| news:uA****************@TK2MSFTNGP12.phx.gbl...
| Hello michelle,
|
| Use
|
system.globalization.cultureinfo.currentculture.nu mberformat.numberdecimalseparator
| and numbergroupseparator to indicate the separators you want.
| Instead of CDbl, use Double.Parse, which uses current thread culture
| information.
|
| Regards.
|
|
| "michele" <mi***********@unipr.it> escribió en el mensaje
| news:%2****************@TK2MSFTNGP14.phx.gbl...
|| Hi, I have a problem with two function: IsNumber() and CDbl() because
when
| I
|| invoke it they throw an exception.
|| The problem I think is International Settings, because
|| NumberDecimalSeparator and NumberDecimalGroup have the same value "."
|| I can't change this setting on computer by default so what I want to know
| if
|| I can change this settings only for my application.
||
|| I've used System.Globalization but CDbl use the settings in contro
pannel.
||
|| Thanks in advice
Feb 11 '06 #5
Yes, michele, the CultureInfo returned by System.Globalization.Cultureinfo.Currentculture is read only. You must replace it. Look at this sample:

Sub Main()

Dim s as String = System.Globalization.CultureInfo.CurrentCulture.Na me

Dim ci As New System.Globalization.CultureInfo(s, True)

System.Threading.Thread.CurrentThread.CurrentCultu re = ci

ci.NumberFormat.NumberDecimalSeparator = ","

Debug.WriteLine(Double.Parse("3,14") * 10)

ci.NumberFormat.NumberDecimalSeparator = "·"

'Debug.WriteLine(Double.Parse("3,14") * 10) 'Error: "," is not part of a number.

Debug.WriteLine(Double.Parse("3·14") * 10)

End Sub

Regards.

"michele" <mi*****@zenna.it> escribió en el mensaje news:%2****************@TK2MSFTNGP14.phx.gbl...
| Ok, maybe I missunderstand how to program so can you explain more, it it is
| possible.
| I've tried to use
| System.Globalization.Cultureinfo.Currentculture.Nu mberformat.NumberDecimalSeparator
| = ","
| but this property is red-only..
|
| Thanks
|
|
| "José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
| news:eQ**************@TK2MSFTNGP10.phx.gbl...
| I don't understand the problem. The PrintPage event runs on the same thread
| on which you call PrintDocument.Print, so it uses the same environment.
|
| Regards.
|
|
| "michele" <mi*****@zenna.it> escribió en el mensaje
| news:OR**************@TK2MSFTNGP11.phx.gbl...
|| Thank you, in fact I've used it and I thought that all was ok but I
|| discovered that I used I PrintDocument that involved "International
|| Settings" and I've the applicationt runs ok but I can't print because I
|| don't know how to set enviroment to PrintDocument.
||
|| "José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
|| news:uA****************@TK2MSFTNGP12.phx.gbl...
|| Hello michelle,
||
|| Use
||
| system.globalization.cultureinfo.currentculture.nu mberformat.numberdecimalseparator
|| and numbergroupseparator to indicate the separators you want.
|| Instead of CDbl, use Double.Parse, which uses current thread culture
|| information.
||
|| Regards.
||
||
|| "michele" <mi***********@unipr.it> escribió en el mensaje
|| news:%2****************@TK2MSFTNGP14.phx.gbl...
||| Hi, I have a problem with two function: IsNumber() and CDbl() because
| when
|| I
||| invoke it they throw an exception.
||| The problem I think is International Settings, because
||| NumberDecimalSeparator and NumberDecimalGroup have the same value "."
||| I can't change this setting on computer by default so what I want to know
|| if
||| I can change this settings only for my application.
|||
||| I've used System.Globalization but CDbl use the settings in contro
| pannel.
|||
||| Thanks in advice

Feb 12 '06 #6
Thanks, I write my code with you suggestion and now I thinks that it works
fine but tomorrow I test my application and then I'll tell you if all run.
Thank you again, sincerly Michele

"José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
news:eo**************@TK2MSFTNGP11.phx.gbl...
Yes, michele, the CultureInfo returned by
System.Globalization.Cultureinfo.Currentculture is read only. You must
replace it. Look at this sample:

Sub Main()

Dim s as String = System.Globalization.CultureInfo.CurrentCulture.Na me

Dim ci As New System.Globalization.CultureInfo(s, True)

System.Threading.Thread.CurrentThread.CurrentCultu re = ci

ci.NumberFormat.NumberDecimalSeparator = ","

Debug.WriteLine(Double.Parse("3,14") * 10)

ci.NumberFormat.NumberDecimalSeparator = "·"

'Debug.WriteLine(Double.Parse("3,14") * 10) 'Error: "," is not part
of a number.

Debug.WriteLine(Double.Parse("3·14") * 10)

End Sub

Regards.

"michele" <mi*****@zenna.it> escribió en el mensaje
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Ok, maybe I missunderstand how to program so can you explain more, it it
is
| possible.
| I've tried to use
|
System.Globalization.Cultureinfo.Currentculture.Nu mberformat.NumberDecimalSeparator
| = ","
| but this property is red-only..
|
| Thanks
|
|
| "José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
| news:eQ**************@TK2MSFTNGP10.phx.gbl...
| I don't understand the problem. The PrintPage event runs on the same
thread
| on which you call PrintDocument.Print, so it uses the same environment.
|
| Regards.
|
|
| "michele" <mi*****@zenna.it> escribió en el mensaje
| news:OR**************@TK2MSFTNGP11.phx.gbl...
|| Thank you, in fact I've used it and I thought that all was ok but I
|| discovered that I used I PrintDocument that involved "International
|| Settings" and I've the applicationt runs ok but I can't print because I
|| don't know how to set enviroment to PrintDocument.
||
|| "José Manuel Agüero" <chema012 en hotmail.com> ha scritto nel messaggio
|| news:uA****************@TK2MSFTNGP12.phx.gbl...
|| Hello michelle,
||
|| Use
||
|
system.globalization.cultureinfo.currentculture.nu mberformat.numberdecimalseparator
|| and numbergroupseparator to indicate the separators you want.
|| Instead of CDbl, use Double.Parse, which uses current thread culture
|| information.
||
|| Regards.
||
||
|| "michele" <mi***********@unipr.it> escribió en el mensaje
|| news:%2****************@TK2MSFTNGP14.phx.gbl...
||| Hi, I have a problem with two function: IsNumber() and CDbl() because
| when
|| I
||| invoke it they throw an exception.
||| The problem I think is International Settings, because
||| NumberDecimalSeparator and NumberDecimalGroup have the same value "."
||| I can't change this setting on computer by default so what I want to
know
|| if
||| I can change this settings only for my application.
|||
||| I've used System.Globalization but CDbl use the settings in contro
| pannel.
|||
||| Thanks in advice
Feb 12 '06 #7

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

Similar topics

1
1443
by: Adonis Walmsley-McCarthy | last post by:
Hello all, Could anyone tell me how to detect the username from within MS Access 2000? The operating envrionment is Windows XP Pro, with a Novell Netware client (version 6 I think) on top. I...
1
2138
by: cab2 | last post by:
We currently have an application built in Access that takes in a csv file using docmd.transfertext. We allow users to export their data to a file for later use (csv format). Users are also...
1
1330
by: Lachlan James | last post by:
Hi, I have an asp.net web form that uses a rangevalidation control to validate a date field. My regional settings are set to Australia and it works fine on my system (winXP). However on...
1
1039
by: Priya | last post by:
Hi, In our project we use HttpModules If I specify url as www.xyz.com/eg it calls HttpModule and then redirects it to www.xyz.com/default.aspx But if I specify localhost/eg it displays resource...
2
1377
by: Tim | last post by:
Hi there, I have written a code to perform some data analysis. Because of the "new and improved" international setting on CDbl etc. I have that my users cannot use the software outside UK-US...
1
1372
by: quinto | last post by:
I will doing an installation of MS SQL 2000 that will be used by multi language web sites. The languages are Japanese, German and of course English. Currently I'm planning to install MS SQL 2000...
1
2947
by: modi321 | last post by:
Everyone, I have a question on how to use persistant application settings with 2.0. I understand I can use defined types like ints, strings, and so on, but how about my own custom class? The...
2
1707
by: Bishman | last post by:
Hi, Quick question: Is it possible to use different Solution Configurations ( Release / Build ) in order to determine which DB you are connecting to ( Dev vs Live) I would have thought...
3
2750
by: rsteph | last post by:
This is, I'm sure, and easy question for most. I am a moderate C/C++ programmer in console based programs, I am looking to teach myself windows based programming though. I'm going through a book I...
0
7055
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
7060
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,...
1
6760
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
5365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.