473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Showing a form from within a thread

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


Aug 6 '06 #1
5 1197
is fmViewer an array? or are you trying to do something else....please
explain a little bit more
--
-iwdu15
Aug 6 '06 #2
Jerry Spence1 wrote:
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?
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

Aug 7 '06 #3
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

Jerry Spence1 wrote:
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
Aug 7 '06 #4
Hi Chris

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

-Jerry
"Chris Dunaway" <du******@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Jerry Spence1 wrote:
>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?

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

Aug 7 '06 #5

"Brian Gideon" <br*********@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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

Jerry Spence1 wrote:
>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
Thanks Brian. I'll have a look at Invoke and BeginInvoke.

-Jerry
Aug 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Krzysztof Karnicki | last post by:
I would like develop Form on my Windows Application, that is going to notify the user, just like Microsoft Office 2003 shows that there are new mail coming. When I use System.Windows.Forms.Form and...
2
by: Sharon | last post by:
I have a Form class that can be open by parent Form or by .NET Remoting command. When the parent Form opens the Form - All fine ! But when the .NET Remoting command is trying to Show the Form, the...
8
by: Raed Sawalha | last post by:
I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I...
0
by: BergRD | last post by:
For some odd reason my original post was double posted then removed from the forums. Odd happenings but wanted to re-post incase no one saw the original, thanks :D > Salutations! > > New to...
3
by: EnglishMan69 | last post by:
Hello All, I am using VB2005 Beta 2 in VS 2005 and am running into a small problem. I need to be able to add a picture box to the main form from within a thread. The program goes to a web...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
2
by: Lars Netzel | last post by:
Hi I have a Form that on Form_Load() does some heavy database reading and I want to show that as a progressbar ontop of the main window.. I want to create a smaller Form with a progressbar.....
1
by: Claire | last post by:
Hi I need to set my main form as the owner of an error dialog box shown when there's an exception in a background thread. This is to make sure that the error form is closed down if the user pulls...
7
by: =?Utf-8?B?TWF0dA==?= | last post by:
Hi I have an app that runs without a main form, just a notification icon, when the user clicks the icon the form is shown, and when the form is minimized it's hidden. This all works great,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.