riprendendo l'esempio postato sopra,
una volta aver ordinato l'array, puoi effettuare
un controllo sulle textbox anche nel seguente modo:
codice:
Private Sub Text2_LostFocus() ' passaggio focus ad un altro controllo
If Text2.Text <> persona(1) Then
MsgBox ("ERRORE: Text2 non può essere MINORE di persona(0)")
End If
End Sub
Private Sub Text3_LostFocus() ' passaggio focus ad un altro controllo
If Text3.Text <> persona(2) Then
MsgBox ("ERRORE: Text3 non può essere MINORE di persona(1)")
End If
End Sub
Ad ogni modo la cosa più semplice è la seguente (solo controllo sulle textbox)
codice:
Private Sub Text2_lostfocus()
If Text2.Text < Text1.Text Then
MsgBox ("ERRORE: Text2 non può essere MINORE di Text1")
Text2.SetFocus
End If
End Sub
Private Sub Text3_LostFocus()
If Text3.Text < Text2.Text Then
MsgBox ("ERRORE: Text3 non può essere MINORE di Text2")
Text3.SetFocus
End If
End Sub