473,883 Members | 2,102 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 1571
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
3614
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
2539
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
1402
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
2068
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
3175
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
1498
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
2096
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
2650
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
4320
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
9798
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
10766
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
9588
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
7136
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
5807
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
6007
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4622
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
4230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
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.