Cross-thread issue, invoking? : <p>i have been searching online and cant seem to find an appropriate fix for my error: <code>Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.</code></p>

<p>I looked onto but cant figure out how i invoke my size change?</p>

<p>My code which works some times and the other throws the above code is:</p>

<pre><code>'Handler to handle screen resizes! (Tablet being flipped etc...)
Private Sub TouchRadio_Resize(sender As Object, e As EventArgs) Handles Me.Resize
    Dim thread As New Thread(AddressOf resizescreen)
    thread.Start()
End Sub

Public Sub resizescreen()
    System.Threading.Thread.Sleep(1)
    For index As Integer = 1 To 50000
        If Screen.PrimaryScreen.Bounds.Width = (Screen.PrimaryScreen.Bounds.Width + 17) Then
            Exit For
        End If
        Dim screenWidth As Integer = Screen.PrimaryScreen.Bounds.Width
        screenWidth = (screenWidth + 17)
        Dim screenHeight As Integer = Screen.PrimaryScreen.Bounds.Height
        Me.Size = New System.Drawing.Size(screenWidth, screenHeight) 'Here it errors at
        GeckoWebBrowser1.Size = New System.Drawing.Size(screenWidth, screenHeight)
        Me.Location = New Point(0, 0)
    Next
End Sub
</code></pre>
