Vbsupernul
Messages postés287Date d'inscriptionvendredi 25 octobre 2002StatutMembreDernière intervention18 janvier 2004 4 déc. 2002 à 16:38
Pour ouvrir un fichier
Un conseil, fais un common dialog
CommonDialog1.ShowOpen
lechemin=Commondialog1.FileName
Open lechemin For Input As #1
Line Input #1, Texte
Texte1.Text = Texte
Do While Not EOF(1)
Line Input #1, Texte
Texte1.Text = Texte1.Text & vbCrLf & Texte
Loop
Close 1
Et la même chose pour le 2ème fichier, mais en appellant le 2ème textbox Texte2 (tu remplaces Texte1.Text en Texte2.Text)
Il faut juste 1 textbox nommé Texte1...
Pour la comparaison, il faut faire (je connais pas tt à fait la syntaxe)
If Texte1.line #1 <> Texte2.Line#1 Then
...
C le seul truc que je voies...
Sinon, tu t'emmerde pas, tu me donnes ton e-mail et je t'envoies un prog tout fait...
@+
Vbsupernul (tout le monde le sait maintenant... c'est malin :sad) )
Vous n’avez pas trouvé la réponse que vous recherchez ?
cs_rene38
Messages postés1858Date d'inscriptionsamedi 29 juin 2002StatutMembreDernière intervention17 octobre 201311 5 déc. 2002 à 02:47
'A appeler depuis le code au lieu d'un CommandButton
'Pas très rapide (4 secondes pour 100 ko)
'Pour 2 fichiers de même taille mais différents, ne trouve que la 1ère différence
Private Sub Comparer_Click()
Dim x As Byte, y As Byte, n As Long
Open "D:\Chemin\Fichier1.ext" For Binary As #1
Open "D:\Chemin\Fichier2.ext" For Binary As #2
If LOF(1) <> LOF(2) Then
MsgBox "1er fichier : " & LOF(1) & " octets" & Chr(10) & Chr(10) & "2ème fichier : " & LOF(2) & " octets", , "Tailles différentes"
Close
Exit Sub
End If
Do While Not EOF(1)
n = n + 1
Get 1, , x
Get 2, , y
If x <> y Then
MsgBox "Octet n°" & n & Chr(10) & Chr(10) & "1er fichier : &H" & Hex(x) & Chr(10) & "2ème fichier : &H" & Hex(y), , "Fichiers différents"
Close
Exit Sub
End If
Loop
Close
MsgBox "Fichiers Identiques"
End Sub