Alright so I finished my first program and I'm working on my second. I copied over a bunch of stuff and now the only problem I am having is this error with my progress bar.

"Cross-thread operation not valid: Control 'ProgressBar1' accessed from a thread other than the thread it was created on."

I've fixed this before, but I can't quite remember. Here is the code it is being used by-

Code:
Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged

        ProgressBar1.Value = Convert.ToInt32(100 * P / 2)

    End Sub