473,626 Members | 3,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dialogue form remains visible during program execution

Ger
My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML()) starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing
job, or is there a more simple solution I am not aware of yet? Code below:

Dim fh As New frmHTML
If fh.ShowDialog(M e) = DialogResult.OK Then
'save dialogue data:
'(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCu rrentDirectory
HLang = fh.cmbLanguage. Text
HMainOnly = fh.radMain.Chec ked
HVarCols = Val(fh.txtCols. Text)
DBDirectory = fh.txtOutput.Te xt
fh.Dispose() 'Get rid of the dialogue form (I thought......)
' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger
Nov 21 '05 #1
12 1549
Ger wrote:
My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML()) starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing
job, or is there a more simple solution I am not aware of yet? Code below:

Dim fh As New frmHTML
If fh.ShowDialog(M e) = DialogResult.OK Then
'save dialogue data:
'(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCu rrentDirectory
HLang = fh.cmbLanguage. Text
HMainOnly = fh.radMain.Chec ked
HVarCols = Val(fh.txtCols. Text)
DBDirectory = fh.txtOutput.Te xt
fh.Dispose() 'Get rid of the dialogue form (I thought......)
' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger

Try inserting an application.doe vents right after the dispose. That
gives the app the time to clean up the graphics.

Rinze
Nov 21 '05 #2
Ger,

In my opinion your program should work, did you try it with another dialog
form with by instance only this on it?

Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
Me.DialogResult = DialogResult.OK
End Sub

Just to try the effect?

Cor
"Ger" <ge*********@ra thernospam.sail soft.nl>
My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML())
starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing
job, or is there a more simple solution I am not aware of yet? Code below:

Dim fh As New frmHTML
If fh.ShowDialog(M e) = DialogResult.OK Then
'save dialogue data:
'(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCu rrentDirectory
HLang = fh.cmbLanguage. Text
HMainOnly = fh.radMain.Chec ked
HVarCols = Val(fh.txtCols. Text)
DBDirectory = fh.txtOutput.Te xt
fh.Dispose() 'Get rid of the dialogue form (I thought......)
' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger

Nov 21 '05 #3
Rinze,

The dispose does not close the form, it should give the resources back to
the GC, however I am more and more in doubt if that it is needed. A form
created with the designer implements Idisposable, so it should do it itself.

However there is a MSDN page that tells that only forms showed with show
will be disposed. But it is for me absolute not clear what with that is
meant. I am more and more in doubt if that page is telling about a form that
not implements IDisposable and is made directly by code.

(Therefore I am really curious if your recommendation will help)

Just my thought,

Cor
"C-Services Holland b.v." <cs*@REMOVEcsh4 u.nl>
Ger wrote:
My dialogue form (sometimes partly, sometimes as a whole) remains
visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML())
starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the
processing
job, or is there a more simple solution I am not aware of yet? Code
below:

Dim fh As New frmHTML
If fh.ShowDialog(M e) = DialogResult.OK Then
'save dialogue data:
'(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCu rrentDirectory
HLang = fh.cmbLanguage. Text
HMainOnly = fh.radMain.Chec ked
HVarCols = Val(fh.txtCols. Text)
DBDirectory = fh.txtOutput.Te xt
fh.Dispose() 'Get rid of the dialogue form (I thought......)
' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger

Try inserting an application.doe vents right after the dispose. That gives
the app the time to clean up the graphics.

Rinze

Nov 21 '05 #4
Ger
Cor,
Thank you for your reply. Your example works fine, as other dialogues in my
application do also. But in all these cases the applications awaits further
user interactivity after handling the dialogue, so there is time enough to
close the dialogue.
The problem however seems to be here that the framework (or windows?) is
very busy processing the job (createhtml), and has no time to close the
dialogue form until the job is done. I do not know how to deal with that,
apart from running the job in a separate thread.
Thanks anyway,
/Ger
"Cor Ligthert" <no************ @planet.nl> schreef in bericht
news:uB******** ******@TK2MSFTN GP10.phx.gbl...
Ger,

In my opinion your program should work, did you try it with another dialog
form with by instance only this on it?

Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
Me.DialogResult = DialogResult.OK
End Sub

Just to try the effect?

Cor
"Ger" <ge*********@ra thernospam.sail soft.nl>
My dialogue form (sometimes partly, sometimes as a whole) remains visible during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML())
starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing job, or is there a more simple solution I am not aware of yet? Code below:
Dim fh As New frmHTML
If fh.ShowDialog(M e) = DialogResult.OK Then
'save dialogue data:
'(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCu rrentDirectory
HLang = fh.cmbLanguage. Text
HMainOnly = fh.radMain.Chec ked
HVarCols = Val(fh.txtCols. Text)
DBDirectory = fh.txtOutput.Te xt
fh.Dispose() 'Get rid of the dialogue form (I thought......)
' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger


Nov 21 '05 #5
Ger

"C-Services Holland b.v." <cs*@REMOVEcsh4 u.nl> schreef in bericht
news:ju******** ************@ze elandnet.nl...
Ger wrote:
My dialogue form (sometimes partly, sometimes as a whole) remains visible during a fairly long processing job.
Try inserting an application.doe vents right after the dispose. That
gives the app the time to clean up the graphics.

Rinze


Thank you Rinze, that did the trick! But I inserted the doevents statement
just before the sub (createhtml) is executed, not after the dispose as you
suggest, and it works OK now. Thanks again.

Nov 21 '05 #6
Ger,

When what you say is true, than you can use the information from Rinze

However set than directly after your dialog.OK then that
application.doe vents.
I doubt about it however you never know and "Niet geschoten is altijd
misgeschoten".

I tested it because I am curious as well and have placed on that place a
threading.threa d.sleep(3000), the dialogform did disapear however directly.

Can you show some code from your dialogform?

(I do not think that multithreading is a solution in this, with that it can
be even more difficult to let it disapear).

Cor

"Ger" <ge*********@ra thernospam.sail soft.nl>
....
Cor,
Thank you for your reply. Your example works fine, as other dialogues in
my
application do also. But in all these cases the applications awaits
further
user interactivity after handling the dialogue, so there is time enough to
close the dialogue.
The problem however seems to be here that the framework (or windows?) is
very busy processing the job (createhtml), and has no time to close the
dialogue form until the job is done. I do not know how to deal with that,
apart from running the job in a separate thread.
Thanks anyway,
/Ger
"Cor Ligthert" <no************ @planet.nl> schreef in bericht
news:uB******** ******@TK2MSFTN GP10.phx.gbl...
Ger,

In my opinion your program should work, did you try it with another
dialog
form with by instance only this on it?

Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
Me.DialogResult = DialogResult.OK
End Sub

Just to try the effect?

Cor
"Ger" <ge*********@ra thernospam.sail soft.nl>
> My dialogue form (sometimes partly, sometimes as a whole) remains visible > during a fairly long processing job.
> The dialogue asks the user to enter some data for the job to follow,
> and
> after OK, should disappear and the processing job (Sub CreateHTML())
> starts,
> while showing a progress bar in the main form.
> The problem is that the dialogue form stays visible and does not close
> during execution of the job. It closes after the job is finished.
> What am I doing wrong? Should I start a separate thread for the processing > job, or is there a more simple solution I am not aware of yet? Code below: >
> Dim fh As New frmHTML
> If fh.ShowDialog(M e) = DialogResult.OK Then
> 'save dialogue data:
> '(not relevant I think, but left it in for clearity)
> DBDirectory = Directory.GetCu rrentDirectory
> HLang = fh.cmbLanguage. Text
> HMainOnly = fh.radMain.Chec ked
> HVarCols = Val(fh.txtCols. Text)
> DBDirectory = fh.txtOutput.Te xt
> fh.Dispose() 'Get rid of the dialogue form (I thought......)
> ' do the processing job:
> CreateHTML()
> Else
> fh.Dispose()
> End if
>
> Thank you for replying.
> /Ger
>
>



Nov 21 '05 #7
Ger,

I did not read this message before I sand mine.

:-)

Cor
Nov 21 '05 #8
Ger,

Wrong place so again

I did not read this message before I sand mine where is almost the same said
to try.

:-)

Cor

Nov 21 '05 #9
Cor Ligthert wrote:
Rinze,

The dispose does not close the form, it should give the resources back to
the GC, however I am more and more in doubt if that it is needed. A form
created with the designer implements Idisposable, so it should do it itself.

However there is a MSDN page that tells that only forms showed with show
will be disposed. But it is for me absolute not clear what with that is
meant. I am more and more in doubt if that page is telling about a form that
not implements IDisposable and is made directly by code.

(Therefore I am really curious if your recommendation will help)

Just my thought,

Cor


AFAIK disposing means releasing all resources, thus it should also be
removed from the graphics part. But since a CPU intensive task was
started right away, the OS didn't get time to clean up the graphics
plane so what was left was merely an echo of the form. Calling DoEvents
lets the OS handle those events and redrawing/updating the screen.

At least that's how I understand what is happening :)

Rinze
Nov 21 '05 #10

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

Similar topics

19
3603
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the thing you know ;-) After discovering that access 2000 support form properties (I'm a
3
2532
by: JavaConvert | last post by:
I would like to create form that simply hold textboxes that I log info to during the execution of a single-thread application. In Java, I found JFrame ideal for the task, but I can't recreate the same design with Forms. I can create the Form without Application.Run( ), but when debugging, I can't seem to see any text that gets AppendText'ed to the form. I've done some searching, but cannot find any samples or documentation that use Forms...
6
1389
by: John | last post by:
Hi Is there a way to open a form hidden/invisible while it is populating its controls, and then make it visible once it is done? I am using the following code but the form remains visible. cform = New frmClients cform.Visible = False ' this does not seem to make form hidden (not visible) cform.TopLevel = False
2
2057
by: Rich | last post by:
Can a vb.net form contain a subform? If yes, how is this done? Maybe I am going about my issue the wrong way. I start an asynchronous procedure from my main form - invoke a routine on a mainframe computer. Then I am polling every 10 seconds (timer1) to see if the external program has generated a data result set for my form to retrieve. In the meantime, on the same main form I have a series a little labels that blink on/off in a series...
6
3158
by: Thelma Lubkin | last post by:
I am trying to modify an Access form that allows a user to specify the information s/he needs from a census-type database. The form's code builds a SQL statement from the user's request, and creates from this a record set that is used to populate a new Excel workbook. The form's code opens the new workbook and writes both a datasheet and a graph based on the data to it. The graph appears on the user's screen very briefly and then...
4
1486
by: Graham Charles | last post by:
Hello, I'm finding that if I set the "Cancel" property during the AppStartup event, the application's Splash form remains loaded. A call to the Close property of the SplashForm at that point returns a cross-threading error, since (it appears) the Splashform is loaded by a different thread. Any advice? I could ignore the SplashForm application setting and just
2
2088
by: Arman Sahakyan | last post by:
Hi, While writing code for creating aspx controls dynamically, I noticed some strange (at least to me) behavior. Look at this code; // FreeQuery : System.Web.UI.Page // void cmdDo_Click(...) GridView grid = new GridView();
3
2639
by: Gilberto | last post by:
Hello, I have a form with some buttons that take the user to reports, other forms, etc. On this form the user can see how many products are missing costing and pricing information, through some textboxes that i have designed with some code. The problem is that when the user opens another form, modifies products and comes back to the original form (which remains OPEN) the "status" of the missing products remain the same. In other words, i...
6
4310
by: ewokspy | last post by:
I have a C# program in 2003 that creates a reminder bubble (windows form) to remind a user to pick up their printout. The bubbles show up fine, and they have 2 buttons, a yes and a snooze. The yes resynchs the thread. The snooze puts the bubble to sleep for 5 minutes. Originally my event handler code for the snooze button pointed to the following method: public void SnoozeForm(int minutes) { //VAR TimeSpan waitLength =...
0
8262
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8701
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
8637
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...
1
8364
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6122
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4090
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...
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.