I'm quite new to coding and can't seem to find an answer to this question online. So far I have created a multiple choice quiz and am now working on the nitpicky details.
Right now the quiz works great but I'm just trying to add a function where the button flashes green once for about 250 milliseconds and then goes back to the original color; this would happen each time the button is pressed. This would give the subject an indication of their selection - I know it's a bit redundant but this is what my boss wants (for the record this isn't my main job but just a fun side-project to try and learn some coding). I can't seem to figure out how to make the button flash briefly without staying at that color indefinitely or not flashing at all. In addition, it would be helpful if the button is disabled during this color flash so the patients can't click through the quiz incredibly fast (I believe my code should work for that). Please see my code for the button_click event below. If anyone could help me out it would be greatly appreciated!
(Some extra background):
I have created a quiz for depression. The patient is presented with an unchanging label "In the past TWO WEEKS INCLUDING TODAY..." and then 4 buttons with selections that switch with each button press "0. I do not feel sad", "1. I feel sad much of the time", "2. I am sad all of the time", "3. I am so sad I can barely stand it" (these would then switch to a new topic like sleep or energy). This is an array that changes with each button press.
Please let me know if you need any additional details (I'm always unsure). Cheers!
Private Sub Button_Opt0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Opt0.Click answers(quesNum - 1) = Button_Opt0.Text If quesNum < 23 Then quesNum += 1 Button_Opt0.Text = questions(quesNum -1, 0) Button_Opt1.Text = questions(quesNum -1, 1) Button_Opt2.Text = questions(quesNum -1, 2) Button_Opt3.Text = questions(quesNum -1, 3) '-------What I'm interested in: Button_Opt0.BackColor = Color.Green System.Threading.Thread.Sleep(250) Button_Opt0.BackColor = Color.Empty 'I want the button to return to the original color... '----I don't want the button to be clickable during this color flash: If Button_Opt0.BackColor = Color.AliceBlue Then Button_Opt0.Enabled = False End If Else MarkTest() End If End Sub
Edited by JustLacksZazz: Typo