-
May 13th, 2010, 01:09 PM
#1
Property access must assign to the property or use its value...
I use Visual Basic 2010... and I got that problem (I'm a noob)... please help!
I want to change the label's text when the progressbar hit the values
Private Sub mainfrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Timer1.Enabled = True Then
Label3.Text("blah blah")
End If
If ProgressBar1.Value = 17 Then
Label3.Text("blah blah")
End If
If ProgressBar1.Value = 25 Then
Label3.Text("blah blah")
End If
If ProgressBar1.Value = 32 Then
Label3.Text("blah blah")
End If
If ProgressBar1.Value = 44 Then
Label3.Text("blah blah")
End If
End Sub
End Class
-
May 13th, 2010, 01:16 PM
#2
Re: Property access must assign to the property or use its value...
You could use Select Case
Code:
dim a as string
Select Case Progressbar1.Value
case 17: a="blah blah17"
case 25: a="blah 25"
'...
End Select
Label3.Text = a
But sinye you say this is VB2010 you better put further questions in the VB.NET forum.
We do VB6 here. In such basic stuff both languages are equal, but will differ as more complicated the stuff gets.
-
May 13th, 2010, 01:58 PM
#3
Re: Property access must assign to the property or use its value...
Originally Posted by WoF
You could use Select Case
Code:
dim a as string
Select Case Progressbar1.Value
case 17: a="blah blah17"
case 25: a="blah 25"
'...
End Select
Label3.Text = a
But sinye you say this is VB2010 you better put further questions in the VB.NET forum.
We do VB6 here. In such basic stuff both languages are equal, but will differ as more complicated the stuff gets.
Thank you for the answer! I'll post new questions on VB.NET the next time...
I've tried your code but it didn't work... when i debug the app the text doesn't change it doesn't display anything...
another way to get it working?
-
May 13th, 2010, 02:20 PM
#4
Re: Property access must assign to the property or use its value...
Well, you have put your code into mainfrm_Load() event. Why? It will only ever execute once and at this time ProgressBar1.Value would presumably be 0.
-
May 13th, 2010, 03:18 PM
#5
Re: Property access must assign to the property or use its value...
yep.. if you want the labels to update as the progressbar changes then you would want to place that code in a timer or in a change event that is triggered by the progressbar. Also if the program is going to be busy make sure to issue a refresh for the label after you change the value or you may not see the values as they change.
Always use [code][/code] tags when posting code.
-
May 14th, 2010, 04:42 AM
#6
Re: Property access must assign to the property or use its value...
Originally Posted by DataMiser
yep.. if you want the labels to update as the progressbar changes then you would want to place that code in a timer or in a change event that is triggered by the progressbar. Also if the program is going to be busy make sure to issue a refresh for the label after you change the value or you may not see the values as they change.
I did it and now it works... but not as I would LOL
He changes the label text but just when the progressbar hits the value 25 then the text disappear again... other ideas?
Thank you guys
-
May 14th, 2010, 04:46 AM
#7
Re: Property access must assign to the property or use its value...
Yep I solved!
Dim a As String
Select Case ProgressBar1.Value
Case 17 To 24 : a = "blah blah17"
Case 25 : a = "blah 25"
'...
End Select
Label3.Text = a
I must use to... thank you guys
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
|