Fichier en vb.net

Fermé
infdevlop - 18 mai 2010 à 23:19
Bonjour,



j'ai un probleme dans mon code c'est :le compilateur m'indique que le fichier introuvable et je n'arrive pas a trouver le probléme SVP aidez moi et merci bien à l'avance voici mon code:
Public Sub ajouter(ByVal ccin As String, ByVal cnom As String, ByVal cprenom As String, ByVal cville As String, ByVal cdat As Date)

Dim ligne As String = ccin & ";" & cnom & ";" & cprenom & ";" & cville & ";" & cdat
Dim t() As String
Dim trouv As Boolean = False
Dim sr As New StreamReader("c:\client.txt")
Do While sr.Peek <> -1
ligne = sr.ReadLine
t = Split(ligne, ";")
If t(0) = ccin Then
trouv = True
End If
Loop
sr.Close()
Dim sw As New StreamWriter("c:\client.txt", True)
If trouv = False Then
sw.WriteLine(ligne)
Else
MsgBox(ccin & " déja existe")
End If
sw.Close()
End Sub