No matter what the error is, I don't think it worth looking for after a first glance at your code. What you right has nothing to do with programming. Programming is all about abstraction and code re-use, but you allow yourself to repeat the same code fragment in the long switch block. Ever heard of methods with parameters? Also, you use immediate constants hard-coded in your code. How can you support it? If you allow yourself to repeat a single code fragment several times, there is nothing to talk about. You still need to grasp the basic ideas of programming activity before you go to any advanced topic. Look at some good codes, after all.
No, I have no idea how your code can work as a key logger as your code imply that you have a form which is at least activated. If so, what's the point to load it automatically at all. To handle key presses you need to install Windows Hook. To make a Windows Hook system-global, you need to create it in unmanaged DLL and organize communication with your .NET code. You can start from here
http://msdn.microsoft.com/en-us/library/ms632589%28v=vs.85%29.aspx[
^], but I'm afraid to say it could be well over your head, considering what I mentioned above.
Another thing I would concern about: why would anyone need a key logger? To spy on somebody? If so, I would feel very much ashamed if I'm helpful here.
—SA