Hello,
I'm from Bulgaria, Europe. My name is Emil Georgiev and
I'm a student. I like programming with Visual C++(MFC),
but I have a big problem:
I develop a programe in whom I want to restrict an user
to type into Edit box only numbers(0-9) and some characters
like "," "+" "-" ".". I have seen how to do this using Visual
Basic, but i couldn't do with VC++ :(((.
I'm presenting my idea with visual basic:
1: Private Sub Text1_KeyPress(KeyAscii As Integer)
2: If KeyAscii = 8 Then Exit Sub
3: If (KeyAscii = Asc("-") Or KeyAscii = Asc("+")) And Text1.Text = ""
Then Exit Sub
4:
5: If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
6: KeyAscii = 0
7: End If
8: End Sub
explainings:
-in line 2, i'm allowing to the user to correct his typed text with
backspace.
-in line 3, i'm allowing to the user to type only + and - characters if they
are
in the beggining of the text.
-and in line 5 and 6 i'm restricting the user to type all others characters.
The essence in this example is if the user press character and it is not
allowed from the programmer, its ascii code is assigned to 0 and windows
doesn't appear it.
Would you tell me what to do that with VC++ power?
Yours sincerely Emil Georgiev.
e-mail: s98...@uni-svishtov.bg