Hello Everyone,
I'm a newbie and wanted to see if someone could tell me what is wrong with my code. I'm having trouble getting my light bulb to cut off and on.
Public Class Switch
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
'Exit the form.
Me.Close()
End Sub
Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
' Print the form from printer.
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub
Private Sub BlackRadio_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlackRadio.CheckedChanged
' Display the black text.
If BlackRadio.Checked = True Then
MessageLabel.ForeColor = Color.Black
MessageLabel.Text = "Turn off the light, " & NameBox.Text()
End If
End Sub
Private Sub BlueRadio_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlueRadio.CheckedChanged
' Display the blue text.
If BlueRadio.Checked = True Then
MessageLabel.ForeColor = Color.Blue
MessageLabel.Text = "Turn off the light, " & NameBox.Text()
End If
End Sub
Private Sub RedRadio_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedRadio.CheckedChanged
' Display the Red text.
If RedRadio.Checked = True Then
MessageLabel.ForeColor = Color.Red
MessageLabel.Text = "Turn off the light, " & NameBox.Text()
End If
End Sub
Private Sub GreenRadio_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GreenRadio.CheckedChanged
' Display the Green text.
If GreenRadio.Checked = True Then
MessageLabel.ForeColor = Color.Green
MessageLabel.Text = "Turn off the light, " & NameBox.Text()
End If
End Sub
Private Sub LightBulbOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LightBulbOff.Click
'Turn on light.
LightBulbOff.Visible = True
LightBulbOn.Visible = False
End Sub
Private Sub LightBulbOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LightBulbOn.Click
'Turn off light
LightBulbOn.Visible = False
LightBulbOn.Visible = True
MessageLabel.Text = "Turn off the light, " & NameBox.Text()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NameBox.TextChanged
'Declare the name box.
Dim name As String = Me.NameBox.Text
End Sub
Private Sub Switch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The pictures lights on & lights off are Resources.resx they show up I just cant get the pictures to click on and off.


