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
| Sub tirage()
Dim exercice As Integer = 1
Dim nbreMot As Integer = -1
Dim section, rndnbr, J As Integer
Dim mode As Boolean 'Représente le mode anglais-français ou français-anglais
Dim random As New Random()
Dim reader As New StreamReader("Anglais.txt")
Dim ligne, selected() As String
Do
ligne = reader.ReadLine()
If Mid(ligne, 1, 1) = "[" Then
section += 1
End If
If section = exercice Then
nbreMot += 1
End If
Loop Until ligne Is Nothing
reader.Close()
ReDim Preserve notAllowed(nbreMot)
J = 0
Do
rndnbr = random.Next(0, nbreMot)
If notAllowed(rndnbr) = 0 Then
Exit Do
End If
J += 1
Loop Until J > notAllowed.Length
If J > notAllowed.Length Then
Label1.Text = "Fini !"
Button2.Tag = "Disable"
Retour.Visible = True
Else
rndnbr += exercice
selected = File.ReadAllLines("Anglais.txt")
Dim str() As String = selected(rndnbr).Split("=")
mot = str(0)
answer = str(1)
Label1.Text = mot
notAllowed(rndnbr - exercice) = 1
End If
End Sub |
Partager