473,503 Members | 2,150 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 2055
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
3399
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...
1
1287
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...
2
2475
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
3261
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...
1
5629
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...
5
1203
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 =...
1
1630
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
1946
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,...
2
3420
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 ...
0
7205
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
7093
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
7349
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...
1
7008
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
7467
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
5594
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,...
1
5022
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...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
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 ...

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.