This project is read-only.

Text Input Error

May 27, 2011 at 2:41 PM


Maybe this is a very stupid qusion, but why do I get this error when trying to compile my project?


"System.NullReferenceException was unhandled"


at this line

input.GetKeyboard().CharacterEntered += keyboardCharacterEntered;

Hope you can help (:




May 27, 2011 at 2:50 PM

Well, check that your input field is not null before calling .GetKeyboard() in it. Somewhere in your game's constructor you should have a line saying input = new InputManager(Services, Window.Handle);!

There's a project showing how to use the InputManager in the Demo package. Here's the relevant source: InputDemoGame.cs

May 27, 2011 at 6:08 PM

Ah it works great now, thanks (: