|
-
Dec 2nd, 2011, 11:59 AM
#1
Thread Starter
Lively Member
[RESOLVED] Getting Value Of Progress Bar
Hi everyone, I'm stuck on a progress bar problem. I just wanted to know how I would go about getting the value of a progress bar, and converting it to a string to display in a label.
I am doing a task with the progressbar, and I wanted to know how to get the value of the progress bar, and display it in a label above of it.
I thought :
Code:
TextBox1.Text = ProgressBar1.Value.ToString()
But I get an error.
Any thoughts?
<-- If you like my post, click on the  to the left! It only takes a second... 
-
Dec 2nd, 2011, 12:03 PM
#2
Re: Getting Value Of Progress Bar
What is the error? If you get an error that is relevant to your question, always post the message. The stack trace also helps.
-
Dec 2nd, 2011, 12:15 PM
#3
Thread Starter
Lively Member
Re: Getting Value Of Progress Bar
Sorry...I didn't explain myself well. It wasn't an error that stopped the program and highlighted that line of text, it's just that Label1's text stayed at 0 the entire time the Progress Bar was loading. So, it was an error in my code obviously, but the program can still run.
Sorry for not explaining myself!
<-- If you like my post, click on the  to the left! It only takes a second... 
-
Dec 2nd, 2011, 12:21 PM
#4
Re: Getting Value Of Progress Bar
there is no error in your code... if there was you would get an exception. the problem is in your logic or thinking... unless that line of code is in a loop or something that runs on a regular basis, it's never going to up date... also, it's possible that it is updating, but UI updates are low on the priority level, so the screen may not be actually updating. If the code isn't in a loop, move it into the same loop where you're advancing the progress bar... if it's already there, you can force the textbox to update by invalidating it (textbox1.invalidate ... I think that's right... also ... is there a reason for using a textbox instead of something like a label?
-tg
-
Dec 2nd, 2011, 12:42 PM
#5
Thread Starter
Lively Member
Re: Getting Value Of Progress Bar
Well actually, now that I think about it, I should use a label. This time, I'll try and move the code around in a different spot. I'll tell you how it works.
<-- If you like my post, click on the  to the left! It only takes a second... 
-
Dec 2nd, 2011, 01:08 PM
#6
Thread Starter
Lively Member
Re: Getting Value Of Progress Bar
Good news...it works! Thanks so much for all of your guys help! Have a good day!
<-- If you like my post, click on the  to the left! It only takes a second... 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|