|
-
October 11th, 1999, 09:00 AM
#1
About decimal point....
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
-
October 11th, 1999, 09:25 AM
#2
Re: About decimal point....
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.
-
October 11th, 1999, 09:47 AM
#3
And what's next?
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
-
October 11th, 1999, 09:51 AM
#4
Re: And what's next?
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!)
-
October 11th, 1999, 09:59 AM
#5
Ok, on the way to try your suggestion...
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
-
October 12th, 1999, 02:16 AM
#6
Thanx...
...Lothar!!!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|