Qbasicnews.com

Full Version: on key function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I use the code:

Key 15, chr$(0) + chr$(28)
on key(15) gosub ent
key(15) on

I want to use this code to make it so that when I press enter it goes to the gosub ent. Some times it works, but usually it doesn't, even when I haven't changed the code in any way. IOt worked last week, I saved and quit. I went on again the next day and it didn't work.
Can any one help either ammend this code or create a new one.
I will be gratefull for any advise.
I *never* use ON KEY, its just not a good function. Try this:

Code:
DO
     REM ' --- your main code here

     key$ = INKEY$
     SELECT CASE key$
     CASE CHR$(13) ' (enter key)
          'do this
     END SELECT
LOOP
Thank you I wll try that code tonight. The problem was I couldn't find the Ascill code for enter.
Chr$(13)
CHR$(13) = Carriage Return
CHR$(10) = Line Feed
Quote:Thank you I wll try that code tonight. The problem was I couldn't find the Ascill code for enter.

http://www.jimprice.com/ascii-0-127.gif

Ain't Google a wonderful thing???
:lol: Great, it works, thanks alot. :lol:
No problem andy. But remember... you owe me...... for life!!!!!!! MWAHAHAHAHA!
Quote:No problem andy. But remember... you owe me...... for life!!!!!!! MWAHAHAHAHA!

Don't worry. Seph's kind of cool once you get used to him, Andy. Just takes a while. Tongue
Thanks