D DouglasNYoung Active Member Licensed User Longtime User Sep 20, 2013 #1 Hi, I'm tying to intercept Volume UP and Down with this code (pretty well lifted straight off the forum) Code: Copy Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then Log("Up") Return True End If If ( KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN ) Then Log("Down") Return True End If End Sub but when I try to compile I get Parsing code. Error Error parsing program. Error description: keycode is not a valid identifier. Occurred on line: 51 If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then Click to expand... OR (depending on some factor that I don't understand?) Parsing code. Error Error parsing program. Error description: Input string was not in a correct format. Occurred on line: 51 If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then Click to expand... I can't see anything wrong, but cannot get it to work! No doubt its something simple, but not obvious (to me) - ANY IDEAS? Thanks in advance Douglas
Hi, I'm tying to intercept Volume UP and Down with this code (pretty well lifted straight off the forum) Code: Copy Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then Log("Up") Return True End If If ( KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN ) Then Log("Down") Return True End If End Sub but when I try to compile I get Parsing code. Error Error parsing program. Error description: keycode is not a valid identifier. Occurred on line: 51 If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then Click to expand... OR (depending on some factor that I don't understand?) Parsing code. Error Error parsing program. Error description: Input string was not in a correct format. Occurred on line: 51 If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then Click to expand... I can't see anything wrong, but cannot get it to work! No doubt its something simple, but not obvious (to me) - ANY IDEAS? Thanks in advance Douglas
NJDude Expert Licensed User Longtime User Sep 20, 2013 #2 The code is correct, it must be something in your source code, can you upload your project? Upvote 0
D DouglasNYoung Active Member Licensed User Longtime User Sep 20, 2013 #3 NJDude, If I comment out the entire Sub Activity_KeyPress It compiles and runs OK. Whils I can upload the project, I'd have to blank out database passwords and some http addresses, which means the project wouldn't run correctly, but might compile! Douglas Upvote 0
NJDude, If I comment out the entire Sub Activity_KeyPress It compiles and runs OK. Whils I can upload the project, I'd have to blank out database passwords and some http addresses, which means the project wouldn't run correctly, but might compile! Douglas
NJDude Expert Licensed User Longtime User Sep 20, 2013 #4 Just as a goof, retype the KeyPress routine, do not copy-paste, type it again, some illegal character might be lurking somewhere. Last edited: Sep 20, 2013 Upvote 0
Just as a goof, retype the KeyPress routine, do not copy-paste, type it again, some illegal character might be lurking somewhere.
D DouglasNYoung Active Member Licensed User Longtime User Sep 20, 2013 #6 NJDude, Thanks, I typed it out again and it works - I'm guessing there must be some hidden characters in the cut and paste version! eps, FYI: Line 51 was the 'If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then' Thanks, Douglas Upvote 0
NJDude, Thanks, I typed it out again and it works - I'm guessing there must be some hidden characters in the cut and paste version! eps, FYI: Line 51 was the 'If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then' Thanks, Douglas