Soyez le premier à donner votre avis sur cette source.
Snippet vu 6 336 fois - Téléchargée 46 fois
Public Sub Saisie(Tou, Typ As String) Dim Heur As Boolean Dim Cong As Boolean If Tou = 8 Then Exit Sub If Screen.ActiveControl.SelText <> "" Then If Screen.ActiveControl.SelStart = 0 Then Screen.ActiveControl.Text = Right(Screen.ActiveControl.Text, Len(Screen.ActiveControl.Text) - Screen.ActiveControl.SelLength) Else If Screen.ActiveControl.SelStart = Len(Screen.ActiveControl.Text) - 1 Then Screen.ActiveControl.Text = Left(Screen.ActiveControl.Text, Screen.ActiveControl.SelStart) Screen.ActiveControl.SelStart = Len(Screen.ActiveControl.Text) Else ResStart = Screen.ActiveControl.SelStart Screen.ActiveControl.Text = Left(Screen.ActiveControl.Text, Screen.ActiveControl.SelStart) + Right(Screen.ActiveControl.Text, Len(Screen.ActiveControl.Text) - Screen.ActiveControl.SelStart - Screen.ActiveControl.SelLength) Screen.ActiveControl.SelStart = ResStart End If End If End If Cong = False Heur = False If Typ <> "A" Then If Typ = "C" Then Typ = 1 Cong = True Else If Typ = "H" Then Typ = 2 Heur = True Else If Typ = "-H" Then Typ = -2 Heur = True Else If Not IsNumeric(Typ) Then If MsgBox("Le type de données " & Typ & " est invalide", 16, "Procédure de saisie") = vbOK Then Tou = 0 Exit Sub End If End If End If End If End If If Typ <> 0 Then If Typ > 0 Then If (Chr(Tou) < "0" Or Chr(Tou) > "9") And Chr(Tou) <> "." Then Tou = 0 Beep Exit Sub End If Else If (Chr(Tou) < "0" Or Chr(Tou) > "9") And (Chr(Tou) <> "." And Chr(Tou) <> "-") Then Tou = 0 Beep Exit Sub End If If Chr(Tou) = "-" Then If Len(Screen.ActiveControl) <> 0 Then Tou = 0 Beep Exit Sub End If End If End If A = InStr(1, Screen.ActiveControl, ".") If Chr(Tou) = "." Then If A > 0 Then Tou = 0 Beep Exit Sub End If End If If A > 0 Then If Cong And Screen.ActiveControl.SelStart >= A And Chr(Tou) <> "5" Then Tou = 0 Beep Exit Sub End If If Heur And Screen.ActiveControl.SelStart = A And Chr(Tou) > "5" Then Tou = 0 Beep Exit Sub End If End If If A > 0 And Screen.ActiveControl.SelStart >= A And Len(Screen.ActiveControl) - A = Typ Then Tou = 0 Beep Exit Sub End If Else If Chr(Tou) < "0" Or Chr(Tou) > "9" Then Tou = 0 Beep Exit Sub End If If Chr(Tou) = "." Then Tou = 0 Beep Exit Sub End If End If End If If Len(Screen.ActiveControl) + 1 >= Screen.ActiveControl.MaxLength Then SendKeys "{TAB}{END}", True End Sub
Je passe d'un contrôle a un autre via la touche TABulation.
If Len(Text1.Text) X Then 'X longueur maximum
Text2.SetFocus
End If
(\_/)
merci de me dire c c'est cela que tu voilais faire (^_^)
(")(")
David
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.