1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| Function trichiffre()
Dim SLigne1 As String
Dim SLigne2 As String
Dim chiffre1 As Integer
Dim chiffre2 As Integer
Dim IndiceBoucle As Integer
Dim TemoinPermutation As Boolean = True ' Vaut False quand il n'y a plus de permutation
Dim Temporaire As String
While TemoinPermutation
TemoinPermutation = False
For IndiceBoucle = 0 To ComboBox1.Items.Count - 2
SLigne1 = ComboBox1.Items(IndiceBoucle)
SLigne2 = ComboBox1.Items(IndiceBoucle + 1)
chiffre1 = SLigne1.Substring(1)
chiffre2 = SLigne2.Substring(1)
If chiffre1 > chiffre2 Then
TemoinPermutation = True
Temporaire = ComboBox1.Items(IndiceBoucle)
ComboBox1.Items(IndiceBoucle) = ComboBox1.Items(IndiceBoucle + 1)
ComboBox1.Items(IndiceBoucle + 1) = Temporaire
End If
Next
End While
End Function
Function trilettre()
Dim SLigne1 As String
Dim SLigne2 As String
Dim chiffre1 As String
Dim chiffre2 As String
Dim IndiceBoucle As Integer
Dim TemoinPermutation As Boolean = True ' Vaut False quand il n'y a plus de permutation
Dim Temporaire As String
While TemoinPermutation
TemoinPermutation = False
For IndiceBoucle = 0 To ComboBox1.Items.Count - 2
SLigne1 = ComboBox1.Items(IndiceBoucle)
SLigne2 = ComboBox1.Items(IndiceBoucle + 1)
chiffre1 = SLigne1.Substring(0, 1)
chiffre2 = SLigne2.Substring(0, 1)
If chiffre1 > chiffre2 Then
TemoinPermutation = True
Temporaire = ComboBox1.Items(IndiceBoucle)
ComboBox1.Items(IndiceBoucle) = ComboBox1.Items(IndiceBoucle + 1)
ComboBox1.Items(IndiceBoucle + 1) = Temporaire
End If
Next
End While
End Function |