473,385 Members | 1,676 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,385 software developers and data experts.

MDI forms and threads



I have the following scenario that I'm not quite sure how to implement.

I have a form called frmMain that it's a MDI container, and a form
called frmChild, which some instances of it will be contained in
frmMain.

I also have a procedure called DoSomething that fires in the LOAD event
of frmMain, by the way, it is lunched in its own thread other than the
thread were frmMain was created.

I do this because this procedure (DoSomething) it's a beast (it uses a
lot of CPU resources).

Inside DoSomething, some stuff will happen that will require an instance
of frmChild to be generated and of course it will be contained inside
frmMain.

While DoSomething runs, several instances of frmChild might be
generated.

My problem happens when I try to instantiate a frmChild object, and
declaring its Parent property equal to frmMain, because the complier
says I'm doing this in an unsafe manner, trying to access a form from a
thread other than the one it was created on.

I need a solution for this, it might be a solution for the compiler's
exception, or another since you already now what I'm trying to
accomplish.

I really appreciate it.

Later!


Sep 27 '06 #1
1 916
Any idea guys?

_____

From: Mike [mailto:mi**@hitnext.com]
Posted At: Tuesday, September 26, 2006 11:34 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: MDI forms and threads
Subject: MDI forms and threads


I have the following scenario that I'm not quite sure how to implement.

I have a form called frmMain that it's a MDI container, and a form
called frmChild, which some instances of it will be contained in
frmMain.

I also have a procedure called DoSomething that fires in the LOAD event
of frmMain, by the way, it is lunched in its own thread other than the
thread were frmMain was created.

I do this because this procedure (DoSomething) it's a beast (it uses a
lot of CPU resources).

Inside DoSomething, some stuff will happen that will require an instance
of frmChild to be generated and of course it will be contained inside
frmMain.

While DoSomething runs, several instances of frmChild might be
generated.

My problem happens when I try to instantiate a frmChild object, and
declaring its Parent property equal to frmMain, because the complier
says I'm doing this in an unsafe manner, trying to access a form from a
thread other than the one it was created on.

I need a solution for this, it might be a solution for the compiler's
exception, or another since you already now what I'm trying to
accomplish.

I really appreciate it.

Later!


Sep 27 '06 #2

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

Similar topics

8
by: Mahesh Devjibhai Dhola [MVP] | last post by:
We are building Chat like application using Forms and as a result our programming is becoming complicated to display messages received on different threads in the chat window (due to STA...
4
by: Joey Powell | last post by:
Hello all. For a long time now I have been struggling with a .net Windows Forms problem. In several of my applications, I use the "Process" class from System.Diagnostics to accomplish various task...
4
by: Scott Johnson | last post by:
Hi! Is there a way to "preload" a form using a thread or something else so that my user doesn't have to wait 5 seconds (initializing time) between forms? Some of these forms have tab strips with...
5
by: Simon Verona | last post by:
I have an application with a menu system which creates a new thread when a menu item is selected - some of these other threads may open a form for user interaction. Before the menu system is...
2
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
2
by: anon | last post by:
- realtime application has multiple forms. each form is created on a new (gui) thread. this was supposedly for efficiency reasons, i am told. this was done before i took this project. it was done...
6
by: John | last post by:
Hi I am trying to create (not open) several forms in the background threads using the code given below at the end. 1. Am I doing it correctly? 2. How can I get handle sot these forms in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.