You seem to be breaking the golden rule of threading in Windows Forms
applications: never touch UI objects from any thread other than the thread
on which they were created.
This article discusses how to use multiple threads safely (i.e. without
breaking this rule) in a Windows Forms application:
http://msdn.microsoft.com/msdnmag/is...ultithreading/
There's also a good discussion here:
http://www.yoda.arachsys.com/csharp/...winforms.shtml
In fact if you plan on doing any multithreaded development in Windows Forms,
I'd recommend you read all of Jon Skeet's threading articles:
http://www.yoda.arachsys.com/csharp/threads/
You really need to understand pretty much all of the topics he covers in
these articles before you'll be able to write reliable multithreaded code in
..NET.
--
Ian Griffiths -
http://www.interact-sw.co.uk/iangblog/
DevelopMentor -
http://www.develop.com/
"Charles A. Lackman" wrote:
[color=blue]
> Hello and thank you for your assistance.
>
> I have attempted to accomplish what I need using delegates with no
> success.
> i.e.
>
> //Button Click//
> Dim PollThread As Threading.Thread
> PollThread = New Threading.Thread(AddressOf PollThreadAddress)
> PollThread.Start()
> End Sub
>
> Private Sub PollThreadAddress()
> frm1PollDatabase.TopMost = True
> frm1PollDatabase.ShowDialog()
> End Sub
>
> //Button Click inside frm1PollDatabase that raises an event inside the
> Parent Form//
> Delegate Sub FromMyPage()
> Dim MyDeleg As FromMyPage
>
> Private Sub ApplyMyPage
> MyDeleg = New FromMyPage(AddressOf DelegateFromMyPage)
> MyDeleg.Invoke()
> End Sub
>
> Private Sub DelegateFromMyPage()
> frm1Modify.showdialog
> End Sub
>
> ** frm1PollDatabase is created inside a new thread and must always be on
> top, which works fine. But when the user wants to send that data from
> this
> form to a new form (frm1Modify) the form is displayed but frm1PollDatabase
> becomes disabled because of the Showdialog method. I cannot use show for
> this form to be displayed. If the original thread (Main) displays this
> form
> wont it prevent this problem? The above code did not keep
> frm1PollDatabase
> from being disabled.[/color]