| re: Threading: Showing form in main-thread through different thread
* "Michael Maes" <michael@merlot.com> scripsit:[color=blue]
> In the Load-Event a Thread (trdData)*is created to retreive the Data from the server.
>
> After all the data has been loaded (still trdData) an instance is created of a popup-form to alert the user the Data has been
> loaded.
>
> Dim pop As popMessage = New popMessage
>
> pop.Show("Message")
>
> As you can see the Show-Method of the Form popMessage has been overloaded (to pass the message to display)
>
> *
>
> What happens is the popMessage gets displayed for about 0,05 seconds and disappears then.
>
> I*think the "Invoke-Method" should be called, but I can 't figure-out how[/color]
You can, for example, add a public method to one of your forms, and then
use the form's 'Invoke' method to call the message form. You will find
some resources and samples on multithreaded UIs there:
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp>
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms08162002.asp>
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms01232003.asp>
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/> |