473,786 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Showing Form in New Thread?

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.. and then in the main
form, start a new thread that opens that small form and for each progress
the heavy operation send a new value to the small form thru an event.

I have managed to run a function or a sub in another thread but I can't
figure out how to load a whole window in a new thread and keep sending new
messages to it?

Working with VB.NET and framework 1.1

best regards/
Lars Netzel
Oct 17 '06 #1
2 2070
Lars,

The best to do this is to create and update the progress bar form in
the main UI thread. The worker thread will use Invoke or BeginInvoke
from an existing Form to marshal the execution of a delegate onto the
UI thread to accomplish this.

Brian

Lars Netzel wrote:
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.. and then in the main
form, start a new thread that opens that small form and for each progress
the heavy operation send a new value to the small form thru an event.

I have managed to run a function or a sub in another thread but I can't
figure out how to load a whole window in a new thread and keep sending new
messages to it?

Working with VB.NET and framework 1.1

best regards/
Lars Netzel
Oct 17 '06 #2
Idealy you should not be calling Window functions from anything but the
main AppDomain thread. You should call Invoke on any form control or by
getting the AppDomain thread object.

You then need to Invoke a function that will launch the Dialog. You can
signal to the Dialog using the same method.
Lars Netzel wrote:
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.. and then in the main
form, start a new thread that opens that small form and for each progress
the heavy operation send a new value to the small form thru an event.

I have managed to run a function or a sub in another thread but I can't
figure out how to load a whole window in a new thread and keep sending new
messages to it?

Working with VB.NET and framework 1.1

best regards/
Lars Netzel
Oct 17 '06 #3

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

Similar topics

2
3414
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 show it on a different then main thread on my application, this new form became focused, but I want that new form at the beginning acts like just stay-on-top notification… also in this form I would like have controls, that could be focused,...
1
1296
by: kurotsuke | last post by:
Hi, I need to show a form from a secondary thread and I'm using the Invoke method to call the delegate on my form. I would like to display the form and issuing the command from the secondary thread. My problem is that the Show seems to do nothing. I put a breakpoint and it isn't even triggered. On the other hand if the form is visible I can alter its properties via Invoke. Any ideas on how to solve it? Is it possibile to display a...
2
2494
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 Form stuck !! I tried to change the Remoting delegate invocation to asynchronous and to synchronous, yet both cause the same Form Show() to stuck. When I mean stuck, I mean the the Form is shown but non of it controls are shown, only gray window...
8
3279
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 enabled minimize, maximize moving form while processing in underway?
1
5688
by: Alpha | last post by:
I'm working with a Window based application. I have a small form with just 1 label control which is set as Enabled and Visible. Its text is in black telling users to please wait while application is updating DB. However, the form pops up but the label.text is hot showing at all. What should I check to make this work? Thanks, Alpha
5
1220
by: Jerry Spence1 | last post by:
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
1
1635
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 their security card while the error window is being shown. In visual studio 2003, my main form set a static "owner" variable within my frmWarning class definition and if the error form was needed (and null owner passed) then this static variable...
7
1960
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, and I have implemented single instance so that when another instance is run, an event gets signalled in the 1st instance, and what I would like to do is to show the form. I can do this using Form.Invoke to show the form in most cases, however at...
2
3436
by: pandehrushikesh | last post by:
I am doing setup project in VS 2008. I used custom action to select file from local drives. On the button click of custom action form, I am launching Open file dialog as ofdGetNetPath.ShowDialog When I run the setup on Vista, and click the button to open the openFileDialog, it hanged, form becomes non responsive and I have to cancel the setup. on debugging I got following error "Current thread must be set to single thread apartment...
0
10363
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.