Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / August 2006

Tip: Looking for answers? Try searching our database.

Showing a form from within a thread

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry Spence1 - 06 Aug 2006 09:56 GMT
I have the following which generates MDI forms, but doesn't show them at
this stage:

For n As Integer = 1 To 10

fmViewer(n) = New frmViewer

fmViewer(n).Tag = n

fmViewer(n).MdiParent = Frm1

Next

From within a new thread I wish to show a form:

fmViewer(4).show

However, it doesn't show. The answer I am sure is because I am trying to
show it from within a thread. How can I achieve this?

-Jerry
iwdu15 - 06 Aug 2006 17:02 GMT
is fmViewer an array? or are you trying to do something else....please
explain a little bit more
Signature

-iwdu15

Chris Dunaway - 07 Aug 2006 14:34 GMT
> I have the following which generates MDI forms, but doesn't show them at
> this stage:
[quoted text clipped - 15 lines]
> However, it doesn't show. The answer I am sure is because I am trying to
> show it from within a thread. How can I achieve this?

What is frmViewer?  Here you are using it as both the name of your
class and the name of the array variable.  Can you show us the
declaration for frmViewer?

Chris
Jerry Spence1 - 07 Aug 2006 21:52 GMT
Hi Chris

fmViwer is the name of my form, fmViewer() is an array. I can see the
difference is rather small!

-Jerry

>> I have the following which generates MDI forms, but doesn't show them at
>> this stage:
[quoted text clipped - 21 lines]
>
> Chris
Brian Gideon - 07 Aug 2006 16:29 GMT
Jerry,

All Form access must be done from the main UI thread.  That includes
creating, manipulating, and showing the Form.  You'll need a reference
to an existing Form or Control that your worker thread will use to
marshal the execution of a delegate onto the UI thread by calling
Invoke or BeginInvoke.  That delegate should contain the code to create
and show the new Form.  Invoke and BeginInvoke are among the very few
members of a Form or Control that are actually thread-safe.

Brian

> I have the following which generates MDI forms, but doesn't show them at
> this stage:
[quoted text clipped - 17 lines]
>
> -Jerry
Jerry Spence1 - 07 Aug 2006 21:53 GMT
> Jerry,
>
[quoted text clipped - 29 lines]
>>
>> -Jerry

Thanks Brian. I'll have a look at  Invoke and BeginInvoke.

-Jerry

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.