Hi All
Using VB 2005
I am writing a program that will be used on machines which have
different locales (English, Norwegian and Swedish)
I am restricting textbox input using keypress to just numbers, control
chars and the decimal point, my problem is that the decimal point on
English machines is the . (dot) unless specifically changed and on
Scandinavian machines is the , (commer). I could just allow both
through the routine but this then gives an added problem that
scandinavia uses the . (dot) as the thousands seperator which would
really cause some confussion.
How do I check for the decimal point set in the machines locale
setup..?
Thanks in advance.
--
Dave Griffiths 3 2738
"Dave Griffiths" <da*********@nospam.hotmail.comschrieb
Hi All
Using VB 2005
I am writing a program that will be used on machines which have
different locales (English, Norwegian and Swedish)
I am restricting textbox input using keypress to just numbers,
control chars and the decimal point, my problem is that the decimal
point on English machines is the . (dot) unless specifically changed
and on Scandinavian machines is the , (commer). I could just allow
both through the routine but this then gives an added problem that
scandinavia uses the . (dot) as the thousands seperator which would
really cause some confussion.
How do I check for the decimal point set in the machines locale
setup..?
Thanks in advance.
See members of
System.Globalization.CultureInfo.CurrentCulture.Nu mberFormat
Though, I suggest not to limit user input /while typing/. It's a pain,
often. In addition, pasting via clipboard would have to be handled, too.
Instead, use the TryParse-methods (e.g. decimal.tryparse) and give a visual
feedback, like a different text color for invalid input. Give a hint (msgbox
etc) to the user not before leaving the field or when you really need to
process the input. Just a suggestion.
Armin
Thanks Armin for the reply so quickly.
I like the suggestion of tryparse will make the program a little more
user friendly.
Thanks again fot your suggestions.
--
Dave Griffiths
Armin Zingler wrote:
"Dave Griffiths" <da*********@nospam.hotmail.comschrieb
Hi All
Using VB 2005
I am writing a program that will be used on machines which have
different locales (English, Norwegian and Swedish)
I am restricting textbox input using keypress to just numbers,
control chars and the decimal point, my problem is that the decimal
point on English machines is the . (dot) unless specifically changed
and on Scandinavian machines is the , (commer). I could just allow
both through the routine but this then gives an added problem that
scandinavia uses the . (dot) as the thousands seperator which would
really cause some confussion.
How do I check for the decimal point set in the machines locale
setup..?
Thanks in advance.
See members of
System.Globalization.CultureInfo.CurrentCulture.Nu mberFormat
Though, I suggest not to limit user input /while typing/. It's a
pain, often. In addition, pasting via clipboard would have to be
handled, too. Instead, use the TryParse-methods (e.g.
decimal.tryparse) and give a visual feedback, like a different text
color for invalid input. Give a hint (msgbox etc) to the user not
before leaving the field or when you really need to process the
input. Just a suggestion.
Armin
When i encountered a simular problem i noticed that the windows calculator
and programs from MS ( excel for instance ) behaved exactly how i wanted it
see this thread with some nice solutions and in the end the simple solution
that replicated exactly the behavior of calc.exe and excel http://groups.google.nl/group/micros...4f59279602071c
"Dave Griffiths" <da*********@nospam.hotmail.comschreef in bericht
news:BP*********************@telenor.com...
Thanks Armin for the reply so quickly.
I like the suggestion of tryparse will make the program a little more
user friendly.
Thanks again fot your suggestions.
--
Dave Griffiths
Armin Zingler wrote:
>"Dave Griffiths" <da*********@nospam.hotmail.comschrieb
Hi All
Using VB 2005
I am writing a program that will be used on machines which have
different locales (English, Norwegian and Swedish)
I am restricting textbox input using keypress to just numbers,
control chars and the decimal point, my problem is that the decimal
point on English machines is the . (dot) unless specifically changed
and on Scandinavian machines is the , (commer). I could just allow
both through the routine but this then gives an added problem that
scandinavia uses the . (dot) as the thousands seperator which would
really cause some confussion.
How do I check for the decimal point set in the machines locale
setup..?
Thanks in advance.
See members of
System.Globalization.CultureInfo.CurrentCulture.Nu mberFormat
Though, I suggest not to limit user input /while typing/. It's a pain, often. In addition, pasting via clipboard would have to be handled, too. Instead, use the TryParse-methods (e.g. decimal.tryparse) and give a visual feedback, like a different text color for invalid input. Give a hint (msgbox etc) to the user not before leaving the field or when you really need to process the input. Just a suggestion.
Armin
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing/modifying the code.
Thank you.
.. Facundo
|
by: John Bentley |
last post by:
John Bentley:
INTRO
The phrase "decimal number" within a programming context is ambiguous. It could
refer to the decimal datatype or the related but separate concept of a generic
decimal number....
|
by: Peter Blatt |
last post by:
Does 5 represent the total numer of digits (including the fractional portion) or only the number of places
BEFORE the decimal point? Moreover does the number include the decimal point?
Are there...
|
by: cody |
last post by:
no this is no trollposting and please don't get it wrong but iam very
curious why people still use C instead of other languages especially C++.
i heard people say C++ is slower than C but i can't...
|
by: Paul Sullivan |
last post by:
decimal d;
d = 1.1M
OR
d= (decimal) 1.1
Discussioon
|
by: Kuljit |
last post by:
I am doing Engineering(B.Tech) in Computer Science.
I have a question for which i am struggling to write a C code(program).
It struck me when we were being taught about a program which counts the...
|
by: corley |
last post by:
Hello world,
I am having a problem with the decimal symbol. The result of writing a
floating-point-number
to an xml document (using libxml2 from xmlsoft.org) is
<number>10,1234</number>
...
|
by: Andrew Wrigley |
last post by:
Hi, I have a string:
"100.00"
....that I want to parse into a decimal. So:
decimal d = decimal.Parse("100.00", System.Globalization.NumberStyles.Any)
On my dev machine (United Kingdom),...
|
by: =?Utf-8?B?THVpZ2k=?= |
last post by:
Hi all,
with this code:
decimal? test = 1200345.56m;
decimal? test2 = Decimal.Parse(String.Format("{0:0,0.000}", test));
i can not obtain a decimal value with thousands separators (but...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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: 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,...
| |