Pretty new to programming. I've managed to come up with this to change the colour of a button once it's pressed. I'm trying to get the text of the button which is clicked on by using the string ChosenRoom
, however once I come to save, the value of the string is nothing so I must be doing something wrong.
Private Sub ChangeColor(Sender As Object, e As EventArgs)
Dim SenderButton As Button = Sender
If YellowButton IsNot Nothing Then
YellowButton.BackColor = Me.BackColor
End If
If SenderButton IsNot YellowButton Then
SenderButton.BackColor = Color.Yellow
ChosenRoom = SenderButton.Text
End If
YellowButton = Sender
End If
End If
This is what I am using to save the string
cmd1.Parameters.Add(New OleDbParameter("Room Number", CType(ChosenRoom, String)))