void xx()
{
//code to progress the progress bar
//reading data from a file
}
how to relate a progress bar with a process
Page 1 of 110 Replies - 6265 Views - Last Post: 17 April 2009 - 05:37 AM
Replies To: how to relate a progress bar with a process
#2
Re: how to relate a progress bar with a process
Posted 13 April 2009 - 06:51 AM
Seeing as you joined today and you post absolutely no code whatsoever maybe you should edit your post and at least post a complete question. Why are you people so lazy dammit?
#3
Re: how to relate a progress bar with a process
Posted 13 April 2009 - 12:06 PM
i'll explain it for him seeing he wont do it .... anyway i need this too so ...
He needs something like the progress bars the installers use. Show u how much % of the function is complete. i'll give an example
The % done depends on the tasks that are completed and how much are they and how much are left.
He needs something like the progress bars the installers use. Show u how much % of the function is complete. i'll give an example
------> start of function ------> progressbar 0% complete. Some code ------> progressbar 20% done code ------> progressbar 40% done some more code ------> progressbar 60% and some more ------> progressbar 80% -------> end of function ------> progressbar 100% complete.
The % done depends on the tasks that are completed and how much are they and how much are left.
This post has been edited by Cha0sBG: 13 April 2009 - 12:07 PM
#4
Re: how to relate a progress bar with a process
Posted 14 April 2009 - 10:41 PM
first tell us with what you want to link it.
#5
Re: how to relate a progress bar with a process
Posted 15 April 2009 - 02:16 AM
make a simple example
like searching all processes , adding they're process names to a listview or listbox and some other stuff to make it more interesting
#6
Re: how to relate a progress bar with a process
Posted 15 April 2009 - 04:56 AM
Do you want a tool like "Press Solution Button for make your live easier"??? that don't exist.
#7
Re: how to relate a progress bar with a process
Posted 15 April 2009 - 06:24 AM
obviously what we are asking can be made. And if u can't post anything helpful don't post at all. This is a forum for asking for help, and comments like that are useless.
Sorry for the off-topic
Sorry for the off-topic
#8
Re: how to relate a progress bar with a process
Posted 15 April 2009 - 01:24 PM
I'm not going to be extremely helpfull, as I'm not going to write the code for you, but I'll try to at least point you in the right direction. My references may be a bit off, since I'm going from memory here.
There is a progress control either already included in the GUI designer, or can be added. Just like every other control, it has some properties that can be set at build time, or manipulated through code.
You'll first need to add the progress control to your form, then you can look at it's properites so you can find the correct names of the properties you'll want to control from the code.
Essentially, you'll want to be able to control it's current value, but you'll also want to know what it's maxvalue is as well.
Next you'll want to know how many steps your going to need to complete, and how many steps you have done. Then we'll do some basic math to calculate a percentage from that.
For instance, let's say your app has 250 steps to complete total, and you've done 25 steps so far. The formula to calculate percentage is:
percentage = (StepsDone / StepsTotal)*100
Once you've done that, you need to reverse the math using only the percentage, and the maxvalue from the control. The formula would be:
control.currentvalue = (control.maxvalue / percentage)*100
That's the basics behind the formula you need.
There is a progress control either already included in the GUI designer, or can be added. Just like every other control, it has some properties that can be set at build time, or manipulated through code.
You'll first need to add the progress control to your form, then you can look at it's properites so you can find the correct names of the properties you'll want to control from the code.
Essentially, you'll want to be able to control it's current value, but you'll also want to know what it's maxvalue is as well.
Next you'll want to know how many steps your going to need to complete, and how many steps you have done. Then we'll do some basic math to calculate a percentage from that.
For instance, let's say your app has 250 steps to complete total, and you've done 25 steps so far. The formula to calculate percentage is:
percentage = (StepsDone / StepsTotal)*100
Once you've done that, you need to reverse the math using only the percentage, and the maxvalue from the control. The formula would be:
control.currentvalue = (control.maxvalue / percentage)*100
That's the basics behind the formula you need.
#9
Re: how to relate a progress bar with a process
Posted 15 April 2009 - 04:12 PM
Everything u sayd i alredy knew .... my question was how to detect that the steps i've done and how much are left .... or do i have to add the progressbar code after every line of my general code ... and if i dont have to add after every line what to do lolz .... this kinda didn't help me even 1 bit .
#10
Re: how to relate a progress bar with a process
Posted 17 April 2009 - 01:21 AM
I wont give you answer for process but I will give you an example here it is hope that will help on how to retreive mp3
The progressbar value always as to be in a loop of your process to increment it
foreach (DirectoryInfo di in dir.GetDirectories())
{
FileprogressBar.Maximum = Directory.GetFiles(di.FullName, "*.mp3").Length;
FileprogressBar.Minimum = 0;
int counts = 0;
// Now to get every song in the folder
foreach (FileInfo fi in di.GetFiles())
{
if (fi.Extension == ".mp3")
{
songUrlTextBox.Text = fi.FullName;
songTextBox.Text = fi.ToString();
++counts;
FileprogressBar.Value = counts;
}
}
}
FileprogressBar.Value = 0;
The progressbar value always as to be in a loop of your process to increment it
#11
Re: how to relate a progress bar with a process
Posted 17 April 2009 - 05:37 AM
Essentially, you will have to have a call to your AddProgress function after just about every line of code, or whereever you want to update it at. It works best from within loops though.
But yes, every progress bar I've ever created is called after every line. To determine how many steps are involved, you simply count how many calls to the function you have.
For instance, let's say you call the function 3 times outside of any loops, then once in a loop. Your formula for calculating the number of steps is as simple as 3+loop. So if in your code, the loop is repeated 4 times, then the formula would be 3+4 or steps=7. This obviously changes if you call the function more than once in the loop. Let's say that you call the function 3 times outside of any loops, twice in the first loop, and three tiimes in the second loop. Your formula is now steps=3+(2*loop1)+(3*loop2). You dig?
But yes, every progress bar I've ever created is called after every line. To determine how many steps are involved, you simply count how many calls to the function you have.
For instance, let's say you call the function 3 times outside of any loops, then once in a loop. Your formula for calculating the number of steps is as simple as 3+loop. So if in your code, the loop is repeated 4 times, then the formula would be 3+4 or steps=7. This obviously changes if you call the function more than once in the loop. Let's say that you call the function 3 times outside of any loops, twice in the first loop, and three tiimes in the second loop. Your formula is now steps=3+(2*loop1)+(3*loop2). You dig?
This post has been edited by magius96: 17 April 2009 - 05:39 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|