Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

InvalidNetworkVariableNameError

Hi,

I am attempting to spawn a thread and use it to write an NV.  However, I am gettin the error "InvalidNetworkVariableNameError" when I try to perform the .connect.   What does this error mean?  The location I'm trying to write to (held in the string variable NetworkVariableLocation) is correct.

Here's a snippet of the code i'm using.

Public Sub thread_heartBeat()

        Dim HBeatValue As Double
        Dim NV As New NVReadWrite
       
        ' Do this until the thread is canceled.
        Do
            ' This is used as a semaphore telling this thread
            ' whether or not to write the heartbeat.
            If go Then

                HBeatValue = System.DateTime.Now.ToOADate

                Dim NetworkVariableLocation As String
                NetworkVariableLocation = path
                Dim NVWriter As New NetworkVariableWriter(Of Double)(NetworkVariableLocation)

                Try
                    NVWriter.Connect()
                    NVWriter.WriteValue(HBeatValue)
                    NVWriter.Disconnect()
               Catch currentError As Exception
                  ' Log the problem here
               End Try

            End If

            ' Wait 2 seconds then send the heartbeat again.
            System.Threading.Thread.Sleep(2000)
        Loop

    End Sub

Any suggestions would be helpful.  Thanks.
0 Kudos
Message 1 of 2
(3,178 Views)
Nevermind - found the problem.  It's the difference between \ and \\ in the pathname.

0 Kudos
Message 2 of 2
(3,176 Views)