Bonjour,
je suis en train d'essayer de créer un petit contrôle parental. Cependant, j'ai un problème avec l'écriture des logs des mots tapés. J'ai crée mon code qui compare la liste des mots interdit (exemple : drogue, alcool...) avec les logs.
L'écriture des logs et la comparaison se fait avec un timer qui appel la fonction.
Cependant, lorsque l'écriture des logs se fait pour la deuxième fois, troisième ... Le fichier logs est "occupé par une autre application". Je ne vois pas d'où peut venir le problème.
J'espère que vous pourrez m'éclairer.
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Try Do Dim EcritureLogs As StreamWriter = New StreamWriter("C:\Logs.txt") EcritureLogs.Write(TextBox1.Text) EcritureLogs.Close() MotListe = StreamReaderListeMots.ReadToEnd StreamReaderListeMots.Close() 'on verifie si ligne n'est pas vide If MotListe = String.Empty Then Exit Do End If If MotDansLogs.Contains(MotListe) Then TextBox1.Clear() MotDansLogs = Nothing Call ScreenShot(PictureBox1) Dim ThreadEnvoiMail As New Threading.Thread(AddressOf EnvoiMail) ThreadEnvoiMail.Start() 'METTRE CODE ENVOI DES LOGS ! 'CORRIGER LE BUG DE DETECTION LISTE DES MOTS SI PLUSIEURS MOTS End If Loop Until MotListe = String.Empty Catch ex As Exception MessageBox.Show(ex.ToString) End Try![]()
Partager