Author Topic: File I/O error with DataLogger2  (Read 1030 times)

iDeeW

  • Newbie
  • *
  • Posts: 18
    • View Profile
File I/O error with DataLogger2
« on: February 21, 2017, 04:47:40 PM »
Please look at the attached picture. Any ideas why I'm having this error.
No other program is accessing this file.

Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: File I/O error with DataLogger2
« Reply #1 on: February 21, 2017, 05:43:38 PM »
Do you have more than 1 DataSubscriber writing to the same file?

What driver are you using?

Phrog30

  • Guest
Re: File I/O error with DataLogger2
« Reply #2 on: February 21, 2017, 08:41:10 PM »
I had a similar error on filestream, writing to XML.  It would work the first time, but the next time I would get an error, stating it was in use.  After the write, I disposed and this resolved things.  Not sure if that is the proper fix, but that's what I did.

Code: [Select]
Dim stream As New System.IO.FileStream(sAppPath, System.IO.FileMode.Create)
        ds.WriteXml(stream)
        stream.Dispose()
        Load_Table()

James

iDeeW

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: File I/O error with DataLogger2
« Reply #3 on: February 22, 2017, 10:46:57 AM »
I only have a BasicDataLogger2 with a ModbusTCP driver.

I have a DataSubscriber on the form too. But its not writing to any files.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: File I/O error with DataLogger2
« Reply #4 on: February 22, 2017, 05:52:44 PM »
Maybe try changing the code to:

Code: [Select]
            If sw Is Nothing Then
                Dim fs1 As New System.IO.FileStream(m_FileFolder & "\" & m_FileName, System.IO.FileMode.Append)
                sw = New System.IO.StreamWriter(fs1, System.Text.Encoding.ASCII)
            End If

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: File I/O error with DataLogger2
« Reply #5 on: February 22, 2017, 06:48:09 PM »
Put a break point at that line of code by clicking in the left margin, then run the application. When it hits the break point hit F5. See if it hits the break point a second time.