4 Replies - 23172 Views - Last Post: 22 July 2008 - 02:37 PM Rate Topic: -----

#1 jvdub22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 24-April 08

progress bar while loading a child form

Posted 21 July 2008 - 08:36 PM

i am writing an application that has an mdi child form that takes a while to load. while the child form is loading i would like to open a small form that displays a marquee progress bar to show the child form is busy loading. i know i need to do this using multi-threading and i've looked into the backgroundworker object, but im not sure how to implement this since my progress bar is on a separate form. i call the child form like this:

Dim newChildFrm as frmNewChild ' mdi Child form that takes long time to load
newChildFrm.mdiparent = me
newChildFrm.show() ' Would like to open another form with progress bar while form is loading

If someone could point me in the right direction on how I could do this I would appreciate it.

Is This A Good Question/Topic? 0
  • +

Replies To: progress bar while loading a child form

#2 vbnetskywalker  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 98
  • Joined: 08-June 08

Re: progress bar while loading a child form

Posted 22 July 2008 - 12:41 AM

hi
open the form with progressbar before the child form ,
and at the end of the loading of the child form give a sign that loading is done so you can close the form with progressbar .

this sign can be a public variable (at the project level)
you can test the value of this variable in a timer or something else
if it means loading is done then close the form with progressbar
I hope I was clear
I hope this helps


vbnetskywalker
Was This Post Helpful? 1

#3 jvdub22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 24-April 08

Re: progress bar while loading a child form

Posted 22 July 2008 - 09:10 AM

View Postvbnetskywalker, on 22 Jul, 2008 - 12:41 AM, said:

hi
open the form with progressbar before the child form ,
and at the end of the loading of the child form give a sign that loading is done so you can close the form with progressbar .

this sign can be a public variable (at the project level)
you can test the value of this variable in a timer or something else
if it means loading is done then close the form with progressbar
I hope I was clear
I hope this helps


vbnetskywalker


I tried opening the form with the progress bar first but the form turns white once the child form begins to load.

Dim newProgress As New frmProgress ' form with progress bar
			newProgress.MdiParent = Me
			newProgress.Show()

			Dim newChildForm As New frmChild 
			newChildForm .MdiParent = Me
			newChildForm .Show() 

Was This Post Helpful? 0
  • +
  • -

#4 djkitt  Icon User is offline

  • D.I.C Head

Reputation: 29
  • View blog
  • Posts: 189
  • Joined: 22-May 08

Re: progress bar while loading a child form

Posted 22 July 2008 - 01:55 PM

One simple way, if your code allows for it, is to call Application.DoEvents occasionally from your slowly loading form.

Otherwise, start your progress bar form.
Then, use a non-gui thread to execute the slow stuff.
When the slow stuff is done, kill the progress bar and show your slow form.


Hope this helps,

This post has been edited by djkitt: 22 July 2008 - 02:01 PM

Was This Post Helpful? 0
  • +
  • -

#5 vbnetskywalker  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 98
  • Joined: 08-June 08

Re: progress bar while loading a child form

Posted 22 July 2008 - 02:37 PM

hi guys .... this is what I like discussing ... :D

View Postdjkitt, on 22 Jul, 2008 - 01:55 PM, said:

use a non-gui thread to execute the slow stuff.


I prefer (in almost all times )using threads only for background operations.

I think he doesn't need it right now :

listen to me jvdub22 ...
there is something wrong with what you're doing.....

1 - If you use loops to change the progress bar value then get sure that you have put ( Application.DoEvents() ) in all loops
djkitt has warned you before me
( it's needed not only in progress bars ,but also in all loops you make )

2 - if you change the progress bar value by a timer then you should increase the interval

--------------------
if nothing of what I mentioned worked with you (god forbidden)
then I have to see the (progress bar form statements
and load sub statements of the child form ) to see what's wrong and then tell you .

hope this discussion helps :^:
I hope I could see more discussions in my family * dreameincode * . :rolleyes:

thanks for every one shared this discussion with us
vbnetskywalker
Was This Post Helpful? 1

Page 1 of 1