Repainting a Label and Picturebox???
I'm trying to use a progressbar one one form to change the text on another form's labels and change the image in the form's picturebox. Here's an example of what I have:
Code:
Dim h As String = wizardscreen9.Label1.Text
Dim msg As String = wizardscreen9.Label2.Text
Dim pic As Image = wizardscreen9.PictureBox1.BackgroundImage
Dim easiertouse As String = My.Resources.easiertouse1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(1)
If ProgressBar1.Value = 10 Then
h = "Easier to use"
pic = My.Resources.easiertouse
msg = easiertouse
End If
End Sub
Yet the form won't repaint anything when I run the program. Any ideas how to fix this? I've already tried
Code:
wizardscreen9.invalidate
and
Code:
application.doevents
.
Code:
wizardscreen9.refresh
NEVER works.
So I have no idea what to do. Any ideas please??
Re: Repainting a Label and Picturebox???
I am a bit confused by seeing your code, as to exactly what you are trying to do.
I suppose what you want is, when the progessbar value is 10, the values of h,msg,pic should be changed
If so then use this
vb Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(1)
If ProgressBar1.Value = 10 Then
wizardscreen9.Label1.Text = "Easier to use"
wizardscreen9.PictureBox1.BackgroundImage = My.Resources.easiertouse
wizardscreen9.Label2.Text = easiertouse
End If
End Sub