Public Function AutomaticMove(Pos As Integer, Inizio As Integer, _
Fine As Integer, Char As Integer) As Integer 'Restituisce un valore progressivo o regressivo (a seconda del tasto 'premuto) per la gestione automatica dell'evidenzazione delle TextBox 'correlate fra loro dagli indici. 'Forma di utilizzo -> AutomaticMove(Pos, Inizio, Fine, Char) 'Pos -> La proprieta' Index del controllo inquisito 'Inizio -> Il valore piu' basso della proprieta' Index della matrice di controlli 'Fine -> Il valore piu' alto della proprieta' Index della matrice di controlli 'Char -> Il valore tasto premuto. Equivalente alla variabile passata KeyCode If Char <> vbKeyUp And Char <> vbKeyDown And Char <> vbKeyReturn Then AutomaticMove = Pos Exit Function End If Select Case Char Case vbKeyUp If Pos <= Inizio Then AutomaticMove = Pos Exit Function End If AutomaticMove = Pos - 1 Case vbKeyDown If Pos >= Fine Then AutomaticMove = Pos Exit Function End If AutomaticMove = Pos + 1 Case vbKeyReturn If Pos >= Fine Then AutomaticMove = Pos Exit Function End If AutomaticMove = Pos + 1 End Select End Function 'La routine si utilizza cosi': Text1(automaticmove(index,0,9,keycode).setfocus '(0 rappresenta l'elemento minimo e 9 il massimo della matrice) |