Hello
i have main mdi parent window from which i want to load a form, but
during creating form object and later calling its Show method i want
to display progress and have the main window responsive. But the problem is
that i cannot load form from another thread, when i try to set its
MdiParent property to main window, i get message that parent and child
cant be on separate threads. I could invoke Show without setting MdiParent,
but when i do that the window dont show up cause the thread terminates
after calling Show, and if i try to suspend it, i get only a part of my
form,
which is not responding. I know that this child form must have a message
loop. For now i create and set whole needed properties of window in separete
thread, and just calling Show in main thread, and it works.
But the best for me would be something like that: i create and invoke Show
on separete
thread, and later eventually i link somehow my child window with parent and
its thread.
thanks for any advices
best regards
roman 5 3209
Roman wrote: i have main mdi parent window from which i want to load a form, but during creating form object and later calling its Show method i want to display progress and have the main window responsive. But the problem is that i cannot load form from another thread, when i try to set its MdiParent property to main window, i get message that parent and child cant be on separate threads. I could invoke Show without setting MdiParent, but when i do that the window dont show up cause the thread terminates after calling Show, and if i try to suspend it, i get only a part of my form, which is not responding.
<snip>
I don't believe you can do the UI part of what you want on a different
thread. However, what exactly is taking a long time when you're
creating the form? Is it doing stuff like fetching from a database? If
so, you could put *that* part into another thread, then create the form
itself on the main UI thread when the rest of the work has been done.
Jon I don't believe you can do the UI part of what you want on a different thread. However, what exactly is taking a long time when you're creating the form? Is it doing stuff like fetching from a database? If so, you could put *that* part into another thread, then create the form itself on the main UI thread when the rest of the work has been done.
the problem is that i want to load not the forms i know, but the foreign
forms that i cant make any assumptions about. i think the most workload
there will be placed in load event of the form. i thought about calling load
handlers myself from loading separate thread but, they might also need
some controls ready and loaded, which means i probably should call it only
after form
is displayed by show. i was just wonder if it is possible to fully create
form
in other thread and then link it somehow to main ui thread
regards
roman
Roman <dz************ @poczta.onet.pl > wrote: I don't believe you can do the UI part of what you want on a different thread. However, what exactly is taking a long time when you're creating the form? Is it doing stuff like fetching from a database? If so, you could put *that* part into another thread, then create the form itself on the main UI thread when the rest of the work has been done.
the problem is that i want to load not the forms i know, but the foreign forms that i cant make any assumptions about. i think the most workload there will be placed in load event of the form. i thought about calling load handlers myself from loading separate thread but, they might also need some controls ready and loaded, which means i probably should call it only after form is displayed by show. i was just wonder if it is possible to fully create form in other thread and then link it somehow to main ui thread
I don't believe it is - unless there's some devious call in the Win32
API to "reparent" a UI in a different thread.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
> I don't believe it is - unless there's some devious call in the Win32 API to "reparent" a UI in a different thread.
ok, thanks for you answer : )
lukasz cygan (roman)
As an implementation idea - you could use events - i.e. when the call finds
it needs to create a form it simply fires the event (indicating "what" on
the event args); to existing UI can catch this, Invoke to itself (to switch
threads) and then create the form. This keeps UI in the UI and data in the
data-tier.
Perhaps ;-0
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob |
last post by:
I was working on a project and everything was going fine,
then all of a sudden the form set as my startup object
stopped loading. I tried setting some others as the
startup object, and some of my forms will load and others
won't. Those that won't load at startup don't load with
the Show or ShowDialog command either. Can anyone give
me a...
|
by: Holmes |
last post by:
Hello
Ran into a bit of a problem here and have now exhausted my resources to getting this working
What I am trying to do is load and show a simple vb form with a listbox in it
Dim frm_nc_code As New frm_nc_sen
frm_nc_code.Show(
Well what I want to have happen is it loads the form then shows all of the controls on the form (especially...
|
by: A.Weinman |
last post by:
Hello all,
I have an application that has multiple forms, only 3 of which matter
for this issue. There is a main form that starts invisible and does
nothing more than start other forms and link them all together. I
also have a Login form and a View form, both started by the main
form. My goal is to have the Login form pop up as soon as...
|
by: Franck |
last post by:
I have a form with a loading bar as marquee so i don't need to play
with the progress thing. It's just a form to show activity in other
way.
So what i need to do is start it at the beginning of the process which
take 10-30 sec depends and have to stop it at the end. I have to use
thread so i can see activity. I just have a little problem....
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |