Hi
I have a little form that has to do a time consuming job, so the correct way to tell the user that the process it's running it's using a progress bar...
So i decided to create a new form with 2 labels and a progress bar, to show over the little window, that show a title the progress and the number of lines already processed.

Everything is working, except the Z order of this form, i can set the form to be top most, but this is not the correct way, so i think that the correct way it's setting the owner of this new form. The only problem it's the cross threaded exceptions.

How can i set the owner of the form without the exceptions?
Should i look to the CheckForIllegalCrossThreadCalls?

vb.net Code:
  1. Dim maxVal As Integer = 30
  2.         Dim newForm As New FormProgress()
  3.         Dim newThr As New Threading.Thread(AddressOf newForm.ShowDialog)
  4.         newThr.Start()
  5.         newForm.SetMaxValue(maxVal) 'Set the progress var
  6.         newForm.SetTitle("Test title...")
  7.         For i As Integer = 1 To maxVal
  8.             Threading.Thread.Sleep(500)
  9.             newForm.SetCurrentValue(i)
  10.         Next
  11.         newForm.CloseForm()