[mono-vb] Wait for key press

Yeek martin505 at tiscalinet.ch
Fri Sep 3 14:47:52 EDT 2010


Hi everyone

I'm an intermediate programmer mainly working with VS 2008 using VB. I'm
currently trying to port two of my projects to Mac OS X using Mono and
MonoDevelop. During the ports I bumped into several issues that I was able
to resolve. But now I'm struggling with a couple of lines that seem not to
work with Mono (but do so with VB). What I would like to do is to continue
code execution only after a certain key was pressed. I implemented the
following lines in my main code:

Go = false
Do
     Application.DoEvents()
     Threading.Thread.Sleep(1)
Loop Until Go = True


And the global variable 'Go' is handled in the following sub:

Private Sub KeyPress(ByVal sender As Object, ByVal e As
System.Windows.KeyEventArgs) Handles Me.KeyUp
     if e.KeyCode = Keys.T then Go = True
end sub

Using the lines above stops the execution of the code completely and key
presses have no impact. Does anyone have an idea why this is the case and
can maybe point me in the right direction on how to solve this issue? 

Any help is greatly appreciated. Thanks in advance!
Martin



-- 
View this message in context: http://mono.1490590.n4.nabble.com/Wait-for-key-press-tp2526099p2526099.html
Sent from the Mono - VB mailing list archive at Nabble.com.


More information about the Mono-vb mailing list