Reputation: 1100
I have a progress bar. I have an increasing int. which i name questionindex I want the progress bar to move just as the integer increases. i.e i want the value of the progressbar to increase as the value of my incremented int increases. I wrote :
ProgressBar.value= questionindex;
questionindex is my Int An exemption was raised saying I can't convert Int to double
Then I used:
ProgressBar.value = questionindex.Tostring();
It said I can't convert string to double lacking an e. Property. Then I create a hidden textblock. I set the text property to my Int.
textBlock.Text= questionindex;
Then equated this to progress bar
ProgressBar.value= textBlock.Text
none of these bits worked.
Upvotes: 0
Views: 3683
Reputation: 1100
A friend just helped. i used this little code and it worked.
ProgressBar.value= Double.Parse(questionindex.ToString());
the Progress Bar increased and moved as the integer increased. the minimum and maximum were set automatically by visual studio.
Upvotes: 1
Reputation: 2192
This works on mine.
int i = 0
while (i < 100)
{
progressBar.Value = i;
i++;
}
the value takes an int
.
If you are creating the progress bar, then you need to it the step and the maximum value before using it.
Also note you to create one use
ProgressBar progressBar = new System.Windows.Forms.ProgressBar();
Thanks for the edit
Upvotes: 0