title: Cross-Thread operation not valid VB.NET
body: <p>I looked around the site and the questions I found relating to this subject were for C# (the application that I am maintaining is written in VB.NET), so I apologize if I overlooked one.</p>
  
  <p>Here is where I am calling my thread:</p>
  
  <pre><code>Private Sub saveBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveBtn.Click
      If Not LoadedFilePath = String.Empty Then
          Dim oTrd = New Threading.Thread(AddressOf SaveData)
          oTrd.Start()
      End If
  End Sub
  </code></pre>
  
  <p>And here are the methods:</p>
  
  <pre><code>Private Sub SaveData()
      SaveData(LoadedFilePath)
  End Sub
  Private Sub SaveData(ByVal filepath As String)
      If InvokeRequired Then
          Me.Invoke(New MethodInvoker(AddressOf SaveData))
      End If
      Try
          Me.Cursor = Cursors.WaitCursor
          Dim oSettings As New SettingsClass(filepath)
          Dim oEnc As New AES
          With oSettings
              //' Code removed for brevity
          End With
          oEnc = Nothing
          oSettings.SaveSettings()
          savedLbl.Visible = True
          If SavedTimeout IsNot Nothing Then
              Try
                  SavedTimeout.StopEvent()
              Catch
              End Try
          End If
          SavedTimeout = New TimedEvent(Now.AddSeconds(5))
          SavedTimeout.StartEvent()
          Me.Cursor = Cursors.Default
      Catch ex As Exception
          MsgBox(ex.Message)
      End Try
  End Sub
  </code></pre>
  
  <p>The save function works just fine, but I get the cross-thread error when the program tries to switch the cursor back to default. What can I do to fix this problem?</p>