944,082 Members | Top Members by Rank

Ad:
Sep 19th, 2006
0

progress bar

Expand Post »
hello to everyone! is there any one can help me to associate the progress bar with the loading application? such that if it finished executing, the progress bar also finished loading.. thanks! i am grateful for the responses. God bless you all!
Similar Threads
Reputation Points: 15
Solved Threads: 4
Junior Poster in Training
arvin2006 is offline Offline
69 posts
since Sep 2006
Sep 28th, 2006
0

Re: progress bar

Well, Arvin2006, it all depends on the application in question, and the code in its Form_Load or Sub Main (depending on which you use to load the application). I'm assuming you mean a progress bar on something like a splash screen.

The trick to setting up a progress bar to indicate how much of an application has loaded is to divide the code which loads the application into distinct parts. From there, you can decide how much to increment the progress bar as each part completes.

For example, suppose I have an application that loads in four parts: reading in registry values, loading one or more plugins, initializing variables and objects, and arranging/displaying the interface. I know that the parts that will take the longest are the second and third, and that they will take much longer than the other two parts to complete, so I decide not to make the progress bar range from 0 units to 4 and have each part worth 1unit - which would make each part fill 1/4 of the progress bar. Instead, I will assign the first and last parts a value of 1 unit each, and the second part a value equal to the humber of plugins I have to load.

For the third part, I will have to do some guessing and estimation. How long will it take to initialize each variable? How long will it take to create and initialize each object? What portion of the entire load time will each variable and object take up? Based on that information, I divide my variables and objects into smaller groups, and assign each group a value of 1. The progress bar now ranges from 0 to 2 + the number of plugins + the number of variable/object groups.

Now, I add a bit of code to my loading process which will bump the progress bar up by 1: after part one finishes, after each plugin is loaded, after each variable/object group is initialized, and after part four is finished. The splash screen with the progress bar on it is set up to unload itself when the progress bar reaches its maximum value.

Of course, the way you break up your progress bar is entirely up to you, and will vary from program to program. But hopefully this gives you an idea of what you need to do to pull this off. Good luck, and enjoy!

- Sendoshin
Reputation Points: 16
Solved Threads: 1
Light Poster
sendoshin is offline Offline
39 posts
since Sep 2006
Oct 4th, 2006
0

Re: progress bar

thanks for the response.. i appreciate it very much. but i dont know how can it be done.. if i will estimate the total loading timeof the application is approximately less than 1 minute. i tried to set 1 minute for the progress bar, but the problem is this: the application will only start loading after the progress bar finished loading, if i will set them at same time (formloadbar.show and "open.exe") the progress bar will be interrupted and not continue loading.. how could i know the part that has been loaded in the application(for example, an executable program like games,etc..) can you pls give me some idea regarding this.. thank you so much!! God bless.
Reputation Points: 15
Solved Threads: 4
Junior Poster in Training
arvin2006 is offline Offline
69 posts
since Sep 2006
Oct 4th, 2006
0

Re: progress bar

how could i break the value of progress bar into parts?
Reputation Points: 15
Solved Threads: 4
Junior Poster in Training
arvin2006 is offline Offline
69 posts
since Sep 2006
Oct 5th, 2006
0

Re: progress bar

Increment the progress bar in the code that actually loads the program, then call DoEvents to refresh the progress bar's display. For the example I gave above:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Load frmProgress
  2. With frmProgress.ProgressBar1
  3. .Max = <number of progress bar parts>
  4. .Value = 0
  5.  
  6. <read in registry values>
  7. .Value = .Value + 1
  8. DoEvents
  9.  
  10. <for each plugin to load>
  11. <load plugin>
  12. .Value = .Value + 1
  13. DoEvents
  14. <next plugin>
  15.  
  16. <initialize variables and objects group 1>
  17. .Value = .Value + 1
  18. DoEvents
  19.  
  20. <initialize variables and objects group 2>
  21. .Value = .Value + 1
  22. DoEvents
  23.  
  24. ' Repeat for each group of variables
  25. ' and objects you initialize
  26.  
  27. <initialize variables and objects group n>
  28. .Value = .Value + 1
  29. DoEvents
  30.  
  31. <initialize interface>
  32. .Value = .Value + 1
  33. DoEvents
  34.  
  35. End With
  36. Unload frmProgress
This is just a simplified example. The code above would be in the project's loading procedure. frmProgress is the Form with the Progress Bar (ProgressBar1) on it. The With statement just makes it easier to write the rest of the code for the Progress Bar - you can just as easily use frmProgress.ProgressBar1.Value = frmProgress.ProgressBar1.Value + 1 instead.

Hope this clears up more for ya!

- Sendoshin
Last edited by sendoshin; Oct 5th, 2006 at 4:30 am.
Reputation Points: 16
Solved Threads: 1
Light Poster
sendoshin is offline Offline
39 posts
since Sep 2006
Oct 6th, 2006
0

Re: progress bar

ok, thank you so much!! have a blessed day! one more pls.. how could i disable the windows keyboard especially the one with the windows,or simply the menu (which opens the start menu and taskbar) i tried using key_press event and have some ascii value for killing the specified key but it doesn't work.. what i want is that it will no longer work if someone pressed this key while vb project is running, so that no one could enter any application.. i think this could be done with API programming or hooking, but i dont have any idea regarding this. pls give me the simplest one.. even the start menu alone. i dont want it to display the start menu. thanks! and may God bless you always!
Reputation Points: 15
Solved Threads: 4
Junior Poster in Training
arvin2006 is offline Offline
69 posts
since Sep 2006
Oct 7th, 2006
0

Re: progress bar

As I suspected, I tried to answer this question before in another thread. What I didn't realize is that you're the one who asked the question!

However, I'd like to answer the question there, in the interest of keeping the solution in the same place the problem was presented. So, without further adieu, I present this link to the other thread. I hope I can help you more on the other side!

- Sendoshin
Reputation Points: 16
Solved Threads: 1
Light Poster
sendoshin is offline Offline
39 posts
since Sep 2006
Dec 25th, 2006
0

Re: progress bar

i have used combobox for item name help, i need code and itemname in variable when i select item form bombo and i want to move cursor according to adding word in search tex.
pls help me send me coding at susamudre@yahoo.com
regards
santosh


Click to Expand / Collapse  Quote originally posted by sendoshin ...
Increment the progress bar in the code that actually loads the program, then call DoEvents to refresh the progress bar's display. For the example I gave above:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Load frmProgress
  2. With frmProgress.ProgressBar1
  3. .Max = <number of progress bar parts>
  4. .Value = 0
  5.  
  6. <read in registry values>
  7. .Value = .Value + 1
  8. DoEvents
  9.  
  10. <for each plugin to load>
  11. <load plugin>
  12. .Value = .Value + 1
  13. DoEvents
  14. <next plugin>
  15.  
  16. <initialize variables and objects group 1>
  17. .Value = .Value + 1
  18. DoEvents
  19.  
  20. <initialize variables and objects group 2>
  21. .Value = .Value + 1
  22. DoEvents
  23.  
  24. ' Repeat for each group of variables
  25. ' and objects you initialize
  26.  
  27. <initialize variables and objects group n>
  28. .Value = .Value + 1
  29. DoEvents
  30.  
  31. <initialize interface>
  32. .Value = .Value + 1
  33. DoEvents
  34.  
  35. End With
  36. Unload frmProgress
This is just a simplified example. The code above would be in the project's loading procedure. frmProgress is the Form with the Progress Bar (ProgressBar1) on it. The With statement just makes it easier to write the rest of the code for the Progress Bar - you can just as easily use frmProgress.ProgressBar1.Value = frmProgress.ProgressBar1.Value + 1 instead.

Hope this clears up more for ya!

- Sendoshin
Reputation Points: 10
Solved Threads: 0
Newbie Poster
susamudre is offline Offline
2 posts
since Dec 2006
Dec 25th, 2006
0

Re: progress bar

Hi Santosh,

Its always better u start a new thread for a new question, or else ur question may go un-noticed.

Anyway here is the code. If u r storing the name in combo list and corresponding ID in Item Data, use this code:

Dim strName As String
Dim strID As Long

strName = Combo1.Text
strID = Combo1.ItemData(Combo1.ListIndex)


Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Thanks
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Listview





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC