473,569 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

modeless form from a multithreaded application

I'm new to VB.net and have a multithreaded application that needs to
display a VB form with a cancel button. The thread that displays the
form needs to set a cancel flag if the button is pressed. It also
needs to look for a thread event that signals that other threads have
completed work. I'm a bit unsure of how to approach this problem.

If I show the form

fProgress.Show( )

it only partially displays (the cancle button is a 'hole') and it is
not active.

I'd appreciate any clues or examples.

Thanks
Nov 20 '05 #1
4 1538
On 2004-03-02, Richard Bell <rb********@ear thlink.net> wrote:
I'm new to VB.net and have a multithreaded application that needs to
display a VB form with a cancel button. The thread that displays the
form needs to set a cancel flag if the button is pressed. It also
needs to look for a thread event that signals that other threads have
completed work. I'm a bit unsure of how to approach this problem.

If I show the form

fProgress.Show( )

it only partially displays (the cancle button is a 'hole') and it is
not active.

I'd appreciate any clues or examples.

Thanks


Richard...

Use fProgress.ShowD ialog() or on this thread call Application.Run to
start a message loop...

Dim t As New Thread(AddressO f ThreadProc)
t.Start
....
Private Sub ThreadProc()
Dim fProgress As New ProgressForm()

Application.Run (fProgress)
End Sub
--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
"Rome wasn't burned in a day. "
Nov 20 '05 #2
Thanks Tom.

My understanding is that ShowDialog() is blocking, in which case my
thread does not continue to run. Is that the case? If so, when my
cancel button is clicked, how do I exit the form so that a ShowDialog
returns to its invoking thread?

If I start a new thread do I have to worry about subsequently doing an
application.exi t? I'm a bit unclear on the notion of forms and what
thread/environment they execute in. In particular the workings of
application.run and exit are not clear.

Thanks again for your help.
On Tue, 02 Mar 2004 22:34:07 -0800, Tom Shelton <to*@mtogden.co m>
wrote:
On 2004-03-02, Richard Bell <rb********@ear thlink.net> wrote:
I'm new to VB.net and have a multithreaded application that needs to
display a VB form with a cancel button. The thread that displays the
form needs to set a cancel flag if the button is pressed. It also
needs to look for a thread event that signals that other threads have
completed work. I'm a bit unsure of how to approach this problem.

If I show the form

fProgress.Show( )

it only partially displays (the cancle button is a 'hole') and it is
not active.

I'd appreciate any clues or examples.

Thanks


Richard...

Use fProgress.ShowD ialog() or on this thread call Application.Run to
start a message loop...

Dim t As New Thread(AddressO f ThreadProc)
t.Start
...
Private Sub ThreadProc()
Dim fProgress As New ProgressForm()

Application.Run (fProgress)
End Sub


Nov 20 '05 #3
* Richard Bell <rb********@ear thlink.net> scripsit:
I'm new to VB.net and have a multithreaded application that needs to
display a VB form with a cancel button. The thread that displays the
form needs to set a cancel flag if the button is pressed. It also
needs to look for a thread event that signals that other threads have
completed work. I'm a bit unsure of how to approach this problem.


<http://www.codeproject .com/cs/miscctrl/progressdialog. asp>

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #4
Thanks all, that was a big help.
On 03 Mar 2004 17:40:56 +0100, hi************* **@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* Richard Bell <rb********@ear thlink.net> scripsit:
I'm new to VB.net and have a multithreaded application that needs to
display a VB form with a cancel button. The thread that displays the
form needs to set a cancel flag if the button is pressed. It also
needs to look for a thread event that signals that other threads have
completed work. I'm a bit unsure of how to approach this problem.


<http://www.codeproject .com/cs/miscctrl/progressdialog. asp>


Nov 20 '05 #5

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

Similar topics

8
9089
by: vince | last post by:
I have a windows app whose main dialog contains a button that launches a form. I've tried using Form.Show() to have it launch as a modeless form, but it behaves as if it's modal (i.e. parent form can't receive focus)... Can someone tell me what I need to do to make the child form modeless..??? I want to be able to alternate focus between...
1
4235
by: Carmine | last post by:
I'm currently writing a small program that churns on a repetitive task while displaying a progress & cancel modeless dialog. I've been having problems due to threadlocking, and I was wondering if anyone could give me some advice. Basically when I create the modeless dialog, I'm assuming that C# under the covers will be implicitly creating a...
0
3171
by: Andrew | last post by:
I get a Null Reference Exception if I close a modeless form (that is, a form displayed using Show()) when a selection is made from a ComboxBox. If the form is modal (displayed using ShowDialog()) or the selection is made from, say, a ListBox, no exception is thrown. I have included a simple example below. The error message refers to Unsafe...
6
3218
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
2
3329
by: Legendary Pansy | last post by:
Hello, I'm trying to accomplish the impossible by trying to do something equivalent of this example found here http://www.c-sharpcorner.com/Code/2003/Dec/DialogTutorial.as Starting with "Listing 2 - Changing the constructor of the modeless dialog to accept the parent object:" line and go onwards is what I'm trying to do Basically, there is...
2
3050
by: proit_123 | last post by:
I am working on a windows forms application and have the following requirement. · I need to display a modeless dialog from the main form. o This allows user to continue to work with the application. o For the sake of example, the user could launch the modeless dialog from Form A and navigate to a Form B in the main window. · When the...
8
5457
by: proit_123 | last post by:
I am working on a windows forms application and have the following requirement. I have two projects in my application Project A and Project B. And Project A has the reference of Project B. I need to display a modeless dialog from the main form which is in Project A and the modeless dialog to be raised is in Project B. After closing the...
5
1758
by: PGP | last post by:
Sorry i asked the same question yesterday but did a bad job on describing the issue so here is a better description. This is in .NET Compact Framework. I have a form which creates modeless forms using code like Form frm = new Form1() ; frm.Show() ;
0
982
by: sree1981 | last post by:
Hello sir, I am developing an application in vb.net. It involves the creation of a modeless form. We need to interact with the aplication window when the form is open. TopMost property sets to True gives the form on top of application. But the form is open and top on other applications also. How to set the modeless form to be open and on top of...
0
7703
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, 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...
0
7618
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...
0
7926
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. ...
0
8138
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...
1
7679
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...
0
7983
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...
0
6287
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...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
946
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...

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.