Bonjour, j'ai un fichier texte qui contient des entrées mais avec le bout de code ci-dessous il met une erreur comme quoi il ne peut pas contenir de valeur null?
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 Dim strLine As String 'Pass the file path and the file name to the StreamReader constructor. objStreamReader = New StreamReader("\mail.txt") 'Read the first line of text. strLine = objStreamReader.ReadLine 'Continue to read until you reach the end of the file. Do While Not strLine Is Nothing 'Write the line to the Console window. Console.WriteLine(strLine) 'Read the next line. strLine = objStreamReader.ReadLine ComboBox1.Items.Add(strLine) 'erreur ici Loop 'Close the file. objStreamReader.Close() Console.ReadLine()
Partager