Ok, so I've tried looking up on several Google sites and cannot find
an answer for this.
Its in VB.Net as a Console Application, the way I want to set this up is almost like BIOS entry, when you turn your computer on you have several seconds to press a key, if its not pressed it will skip on, this is easy enough in a Windows Forms application with a timer, but I'm struggling to do it in Console application.
code so far:
Console.WriteLine("Welcome to console, press F2 for advanced options.")
''Make it pause for 5 seconds, tried obvious threading,thread.sleep(5000) - that halts the application :/
Using a Do loop, Console.KeyAvailable, and a stopwatch
Console.WriteLine("Welcome to console, press F2 for advanced options.") Dim stpw As Stopwatch = Stopwatch.StartNew Dim waitfor As New TimeSpan(0, 0, 5) Dim kp As ConsoleKeyInfo Do If Console.KeyAvailable Then kp = Console.ReadKey(True) If kp.Key = ConsoleKey.F2 Then Exit Do End If End If Loop While stpw.Elapsed < waitfor If kp.Key = ConsoleKey.F2 Then Console.WriteLine("F2 press") Else Console.WriteLine("NO F2") End If