|
-
Sep 27th, 2014, 01:36 PM
#1
Thread Starter
Lively Member
[RESOLVED] Code doesn't do anything?
Hey, how is everyone today?
I have a bit of a problem. Okay, so I have 3 buttons. On the click event, I start a thread. That thread calls a sub at the end, and then that sub calls another sub.
2 of the buttons work fine, they all do the same thing, just with different controls. However, the third button doesn't ever finish the last sub, however nor returns ANY errors or problems.
The code on the click event:
Code:
If My.Settings.au= False Then
auChange = New Thread(AddressOf auEnable)
auChange.IsBackground = True
auChange.Start()
ElseIf My.Settingsau = True Then
auChange = New Thread(AddressOf auDisable)
auChange.IsBackground = True
auChange.Start()
End If
On the auEnable I have the following code:
Code:
Panel24.BackColor = Color.FromArgb(100, 100, 100)
Label9.BackColor = Color.FromArgb(100, 100, 100)
Label8.ForeColor = Color.FromArgb(100, 100, 100)
Label9.Text = "enabled"
PictureBox8.Image = My.Resources.enabled1
My.Settings.au = True
modifyArea()
The same code is for the auDisable sub, except the color is different to 100,100,100 in rgb. It's 10,10,10 instead.
The modifyArea sub has the following code:
Code:
Private Sub modifyArea()
Dim au1On As Boolean = False
Dim au2On As Boolean = False
Dim au3On As Boolean = False
If My.Settings.au = True Then
au1On = True
End If
If My.Settings.au1 = True Then
au2On = True
End If
If My.Settings.au2 = True Then
au3On = True
End If
Dim count As Integer = 0
If au1On = True Then
count += 1
End If
If au2On = True Then
count += 1
End If
If au3On = True Then
count += 1
End If
If count = 3 Then
setCorrectArea()
ElseIf count < 3 Then
setBadArea()
End If
End Sub
Now here's where the problem occurs. In the setBadArea sub which is called, the backcolor changes however the text which I have coded in to change and the color of the text DOES NOT.
The code for setBadArea is as follows:
Code:
Private Sub setBadArea()
Panel6.BackColor = Color.FromArgb(60, 60, 60)
Panel7.BackColor = Color.FromArgb(60, 60, 60)
PictureBox2.Image = My.Resources.incorrectimg
PictureBox2.Left = (Panel7.ClientSize.Width / 2) - (PictureBox2.Width / 2)
Label4.Text = "Incorrect 1"
Label4.Left = (Me.ClientSize.Width / 2) - (Label4.Width / 2)
Label4.ForeColor = Color.FromArgb(60, 60, 60)
Label7.Text = "Incorrect 2" + Environment.NewLine + "Incorrect 3"
Label7.Left = (Panel7.ClientSize.Width / 2) - (Label7.Width / 2)
Label17.Text = "Incorrect 4" + Environment.NewLine + "Incorrect 5"
Label17.Left = (Panel7.ClientSize.Width / 2) - (Label17.Width / 2)
End Sub
As you see in the code, I change text of Label4, Label7, Label 17... And I change the forecolor of Label4 but none of that happens. Only the picturebox and the panel6 backcolor changes. HOWEVER, when I click the other buttons it all works fine. I don't understand why this is? The code for the other buttons are exactly the same, except with au1 and au2 on the settings and not au.
Tags for this Thread
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
|