Dont use CheckForIllegalCrossThreadCalls = False
! And if you do not want to block your UI-Thread, you have to run the (time)expensive operation in the background.
Private Sub ExpensiveFoo(s As String)
If Me.InvokeRequired Then
System.Threading.Thread.Sleep(1000)
Me.Invoke(Sub() ExpensiveFoo(s))
Else
TextBox2.Text = s
End If
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Console.WriteLine(TextBox1.Text)
Dim s As String = TextBox1.Text
Task.Run(Sub() ExpensiveFoo(s))
End Sub
The TextChanged Event now simply starts a task
which will do some work in the background and when it's done, will update a second textbox - WITHOUT using the dreaded CheckForIllegalCrossThreadCalls = False