Click to See Complete Forum and Search --> : About decimal point....
Dr_Michael
October 11th, 1999, 09:00 AM
I have a text box where the user enters a number. Specifically the number must be between 2,45 and 2,80. I control the keys pressed so that the user can only enter numbers, comma character and backspace ofcourse. I don't allow to press "."
But what happens when the user has set to his own PC as decimal point the "." ? How can I check this with code. Or what else can I do?
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Lothar Haensler
October 11th, 1999, 09:25 AM
chris Eastwood has pulished an article that describes how to get access to the locale settings:
http://codeguru.developer.com/vb/articles/1716.shtml
It's the source code for an activex dll.
Dr_Michael
October 11th, 1999, 09:47 AM
So lets say that I use a piece of code of the whole project in order to find out which is the decimal separator on current pc. What comes next? What to do with my text box? Your suggestions?
I must allow each user to press in the specific text box, the decimal point that have selected. How to do that as it differs from user to user?
In order to be much helpful, I give you the code I use till now, pls add there your suggestions (code).
private Sub txtGravity_KeyPress(KeyAscii as Integer)
If KeyAscii = 8 Or KeyAscii = 44 then
Exit Sub
End If
If KeyAscii < 48 Or KeyAscii > 57 then
Beep
KeyAscii = 0
End If
End Sub
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Lothar Haensler
October 11th, 1999, 09:51 AM
in the Form_Load event I'd call GetLocaleInfo API with LOCALE_SDECIMAL constant to get the chosen decimal separator.
sub Form_Load
dim sDecimal as string
GetLocaleInfo...sDecimal
Then in your keypress-Event:
select case keyascii
case 8, 44, asc(sDecimal)
exit sub
...
(this is pcode only!)
Dr_Michael
October 11th, 1999, 09:59 AM
Well, I can easily see that it is pcode (as you say that). Not so stupid, thanx God!
Well thanx a lot, I'll try it. Rating will be tomorrow, because it's late now... ;-) Thanx Lothar and thanx Chris of course for his article...
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Dr_Michael
October 12th, 1999, 02:16 AM
...Lothar!!!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.