Comment inserrer une valeur dans un talbleau ordonnéé?

pixela Messages postés 16 Date d'inscription dimanche 22 mai 2005 Statut Membre Dernière intervention 6 juin 2005 - 23 mai 2005 à 14:44
macgyver49 Messages postés 58 Date d'inscription vendredi 21 janvier 2005 Statut Membre Dernière intervention 5 août 2005 - 23 mai 2005 à 15:16
salut tout le monde!

j'ai créee un tableau d'entier ordonné et je veux inserrer une valeur a la fin du tableau..

mais le probleme c'est que la valeur inserrer doit etre superieure a la valeur d'avant ( pour que le tableau soit bien ordonéé)

voici le code du creation du tableau ca pourrai vous aider) et le code d'insertion:





If (Text1.Text = "") Then



MsgBox ("PLEASE INSERT AN INTEGER ,,,"), , "array"

Else

For i = 0 To n - 1 Step 1

If Val(Label1(i).Caption) >= Val(Text1.Text) Then

MsgBox ("number already exists or inf"), , "array"

Exit Sub



End If



Next i

Label1(n).Caption = Val(Text1.Text)

n = n + 1

Text1.Text = ""



Exit Sub

i = 0



End If





le CS d'insertion:



For i = 0 To n



If Label1(i) = Text1.Text Then Exit For

Next i

If i < n + 1 Then

n = n - 1

For i = i To n

If inserto.Visible True And Val(Label1(i).Caption) Val(Text1.Text) Then

MsgBox ("insert higer number")

Else

Label1(i).Caption = Label1(i + 1).Caption

End If

Next i

End If

et merci d'avance pour votre aide !

2 réponses

macgyver49 Messages postés 58 Date d'inscription vendredi 21 janvier 2005 Statut Membre Dernière intervention 5 août 2005
23 mai 2005 à 15:13
Titi & Panpan
0
macgyver49 Messages postés 58 Date d'inscription vendredi 21 janvier 2005 Statut Membre Dernière intervention 5 août 2005
23 mai 2005 à 15:16
Titi & Panpan
0
Rejoignez-nous