salut tout le monde bon j'avance un peu dans mon programme de répertoire téléphonique mais je suis toujours bloqué! j'ai quelques erreurs mais je ne sais pas comment les corriger merci pour votre aide!!
ça me dit:
que la fonction téléphone ne retourne aucune valeur
que la valeur nomlu, prenomlu et tellu est passé par référence avant qu'une valeur ne lui est été assignée

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Module Module1
    Function telephone(ByVal nom As String, ByVal prenom As String) As String
        If Not existe(nom, prenom) Then
            telephone = "non trouvé"
        Else
            Dim fichierrepertoire As Integer
            Dim nomlu, prenomlu, tellu
            fichierrepertoire = FreeFile()
            FileOpen(fichierrepertoire, "c:\users\simon\desktop\repertoire.txt", OpenMode.Input)
            While Not EOF(fichierrepertoire)
                Input(fichierrepertoire, nomlu)
                Input(fichierrepertoire, prenomlu)
                Input(fichierrepertoire, tellu)
                If nomlu = nom And prenomlu = prenom Then
                    telephone = tellu
 
                End If
            End While
            FileClose(fichierrepertoire)
        End If
    End Function
 
    Function existe(ByVal nom As String, ByVal prenom As String) As Boolean
        If Dir("c:\users\simon\desktop\repertoire.txt") = "" Then
            existe = False
        Else
            Dim fichierrepertoire As Integer
            Dim nomlu, prenomlu, tellu As String, trouvé As Boolean
            fichierrepertoire = FreeFile()
            FileOpen(fichierrepertoire, "c:\users\simon\desktop\repertoire.txt", OpenMode.Input)
            trouvé = False
            While Not EOF(fichierrepertoire) And Not trouvé
                Input(fichierrepertoire, nomlu)
                Input(fichierrepertoire, prenomlu)
                Input(fichierrepertoire, tellu)
                If nomlu = nom And prenomlu = prenom Then
                    trouvé = True
                End If
            End While
            FileClose(fichierrepertoire)
            existe = trouvé
        End If
    End Function
 
    Sub ajoute(ByVal nom As String, ByVal prenom As String, ByVal tel As String)
        If Not existe(nom, prenom) Then
            Dim fichierrepertoire = FreeFile()
            FileOpen(fichierrepertoire, "c:\users\simon\desktop\repertoire.txt", OpenMode.Append)
            PrintLine(fichierrepertoire, nom, prenom, tel)
            FileClose(fichierrepertoire)
        End If
    End Sub
    Dim nom, prenom, tel
    Sub Main()
 
 
        restaureconfig()
        Dim f As Integer
        f = FreeFile()
        FileOpen(f, "c:\users\simon\desktop\repertoire.txt", OpenMode.Output)
        PrintLine(f, "nom", "prenom", "tel")
        FileClose(f)
        sauveconfig()
    End Sub
    Sub sauveconfig()
        Dim fichierconfig = FreeFile()
        FileOpen(fichierconfig, "c:\users\simon\desktop\config.ini", OpenMode.Output)
        WriteLine(fichierconfig, nom, prenom, tel)
        FileClose(fichierconfig)
    End Sub
 
    Sub restaureconfig()
        Dim fichierconfig As Integer
        fichierconfig = FreeFile()
        FileOpen(fichierconfig, "c:\users\simon\desktop\config.ini", OpenMode.Input)
        Input(fichierconfig, nom)
        Input(fichierconfig, prenom)
        Input(fichierconfig, tel)
        FileClose(fichierconfig)
    End Sub
End Module