Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Ok, I must be stupid or something... Can someone please help?!

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?

Firefighters do it with a big hose...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...