be58d2003
Well-known member
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim A As Integer, B As String, FileName As String = "C:\Program Files\TTools202\Aircraft030528.txt"
Dim OpenFile As FileStream = New FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim SR As StreamReader = New StreamReader(OpenFile)
A = A + 1
If A >= 1 Then
Timer1.Enabled = False
Do
B = SR.ReadLine
ComboBox1.Items.AddRange(New Object() {B})
Loop Until B Is Nothing
SR.Close()
OpenFile.Close()
End If
ComboBox1.Enabled = True
End Sub
I want to read a .txt file, and have the items listed (line by line) in the DropDown list... The previous code is what I am trying...
However, I get an unhandled exception error saying that the value can not be null and parameter name: item.
I tested it by clicking "Continue" in the error box. I shows the dropdown list with all of the contents of the .txt file. So what is causing this error?