I'm trying to add the Konami code into one of my Visual Basic projects, but it's not working. The form has 3 panels in it, one for a title, one for a nav bar, and one for the body. The body panel changes the user control when I click different option of a menu strip in the nav panel. I'm trying to make it so that if I type the Konami code, the body panel switches to another user control. The problem is, the code isn't being recognized. I've tried using my Konami code script in a blank project and it works there. Does anyone know what the problem is and how to fix it? I'm using Visual Studio 2019 with a Windows Form App (visual basic) and .NET 5.0.
Public Class Form1
Dim timerTick As Integer = 0 'Tick counter
Dim easterEggStart As Integer = 0 'Time easter egg is started at
Dim easterEggCheckpoint As Integer = 0 'What part of the keycode is the user at?
Dim label1Tick As Integer = 0 'Tick counter for label animation
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Start()
Label1.Text = ""
Me.KeyPreview = True
'Sets starting panel to be the intro panel
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New IntroPage)
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
timerTick = timerTick + 1 'Counts every tick (ms)
label1Tick = label1Tick + 1 'Counts every tick for the title animation (ms)
'Title animation
Select Case label1Tick
Case 0
Label1.Text = "<"
Case 10
Label1.Text = "<W"
Case 20
Label1.Text = "<We"
Case 30
Label1.Text = "<Web"
Case 40
Label1.Text = "<Web"
Case 50
Label1.Text = "<Web "
Case 60
Label1.Text = "<Web D"
Case 70
Label1.Text = "<Web De"
Case 80
Label1.Text = "<Web Dev"
Case 90
Label1.Text = "<Web Deve"
Case 100
Label1.Text = "<Web Develo"
Case 110
Label1.Text = "<Web Develop"
Case 120
Label1.Text = "<Web Develope"
Case 130
Label1.Text = "<Web Developer"
Case 140
Label1.Text = "<Web Developer>"
'Loops the underscore animation
Case 150
Label1.AutoSize = True
Label1.Text = "<Web Developer>_"
Case 160
Label1.AutoSize = True
Label1.Text = "<Web Developer>"
Case 170
label1Tick = label1Tick - 30
End Select
End Sub
Private Sub IntroductionToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles IntroductionToolStripMenuItem.Click
'Switches to intro page
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New IntroPage)
End Sub
Private Sub DescriptionToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DescriptionToolStripMenuItem.Click
'Switches to description page
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New DescriptionPage)
End Sub
Private Sub SalaryToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SalaryToolStripMenuItem.Click
'Switches to salary page
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New SalaryPage)
End Sub
Private Sub EducationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EducationToolStripMenuItem.Click
'Switches to education page
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New EducationPage)
End Sub
Private Sub TechnologiesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TechnologiesToolStripMenuItem.Click
'Switches to technologies page
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New TechnologiesPage)
End Sub
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.C Then 'This was just to test if my form is recognizing key inputs, which it is
BackColor = Color.Red
End If
Select Case easterEggCheckpoint
Case 0 'Up
Select Case e.KeyCode
Case Keys.Up
easterEggStart = timerTick
easterEggCheckpoint = 1
Label2.Text = easterEggCheckpoint
BackColor = Color.Red
End Select
Case 1 'Up
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Up
easterEggStart = timerTick
easterEggCheckpoint = 2
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 2 'Down
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Down
easterEggStart = timerTick
easterEggCheckpoint = 3
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 3 'Down
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Down
easterEggStart = timerTick
easterEggCheckpoint = 4
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 4 'Left
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Left
easterEggStart = timerTick
easterEggCheckpoint = 5
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 5 'Right
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Right
easterEggStart = timerTick
easterEggCheckpoint = 6
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 6 'Left
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Left
easterEggStart = timerTick
easterEggCheckpoint = 7
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 7 'Right
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.Right
easterEggStart = timerTick
easterEggCheckpoint = 8
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 8 'B
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.B
easterEggStart = timerTick
easterEggCheckpoint = 9
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 9 'A
Select Case timerTick
Case easterEggStart To easterEggStart + 3000
Select Case e.KeyCode
Case Keys.A
easterEggStart = timerTick
easterEggCheckpoint = 10
Label2.Text = easterEggCheckpoint
Case Else
easterEggStart = 0
easterEggCheckpoint = 0
Label2.Text = easterEggCheckpoint
End Select
End Select
Case 10
BodyPanel.Controls.Clear()
BodyPanel.Controls.Add(New EasterEgg)
Label2.Text = easterEggCheckpoint
End Select
End Sub
End Class