judsteph
Messages postés1Date d'inscriptiondimanche 3 décembre 2000StatutMembreDernière intervention24 février 2008
-
24 févr. 2008 à 20:08
cs_Exploreur
Messages postés4821Date d'inscriptionlundi 11 novembre 2002StatutMembreDernière intervention15 novembre 2016
-
14 avril 2008 à 23:44
Salut , je voudrais savoir comment faire un controle de saisie de chiffres uniquement dans un Textbox à l'aide du code ASCII dans l'evenment Keypress.
Je sais bien utiliser msgbow asc("A") qui me donne 65 mais pour le controle de saisie je plante...
help...
hksouri
Messages postés2Date d'inscriptionsamedi 6 octobre 2007StatutMembreDernière intervention11 mai 2009 14 avril 2008 à 22:47
Slut tt le monde
Dim i AsInteger
Dim c AsString
'---- Contrôle la validité de la saisie
For i = 1To Len(Text4.Text)
c = Mid$(Text4.Text, i, 1)
If c < "0"Or c > "9"Then
MsgBox "Vous ne pouvez entrer que les chiffres de 0 à 9"
'---- Erreur : place la sélection sur le 1er caractère erroné
Text4.SelStart = i - 1
Text4.SelLength = 1
Text4.SetFocus 'focus sur numero
ExitFor
EndIf
Next
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As system.intptr, ByVal nIndex As
Integer
) As
Integer
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As
system.intptr
, ByVal nIndex As
Integer
, ByVal dwNewLong As
Integer
) As
Integer
Private Function SetTextBoxNum(ByRef Obj As Object) As Boolean
SetWindowLong Obj.hwnd, GWL_STYLE, GetWindowLong(Obj.hwnd, GWL_STYLE) Or ES_NUMBER
End Function
<hr size="2" width="100%" />Prenez un instant pour répondre à [infomsg_SONDAGE-POP3-POUR-CS_769706.aspx ce sondage] svp