I've got this Sub:
Public Sub obtenerValorDeFichero()
Dim ruta As String
ruta = "file.txt"
Dim myFile As New FileInfo(ruta)
Dim sizeInBytes As Long = myFile.Length
While (Convert.ToInt32(sizeInBytes.ToString) < 4)
myFile.Refresh()
sizeInBytes = myFile.Length
End While
Threading.Thread.Sleep(500)
Me.TextBox3.Text = File.ReadAllText(ruta).Trim
End Sub
And I'm calling it in the New code by this way:
Dim myThread As System.Threading.Thread
myThread = New System.Threading.Thread(Sub() obtenerValorDeFichero())
myThread.Start()
But it crashes when try's to change the Me.Textbox3.Text value, how can i do it?