-2

So I have created 2 games (tic tac toe and ping pong). Both games first gave "login" panel and then actual "game" panel. Now I realized that if I press any key on keyboard it goes into text box which is login panel which is hidden when game panel is visible. What could cause that ?

I tried disabling text box and that would work but then if I press key I get that windows error sound.

For code I cant paste it both games have about 600 lines of code I'm hoping that there is something that should be done when you switch panels.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
origin origin2
  • 73
  • 1
  • 2
  • 8
  • 1
    The login has focus, so it takes the key press. Disabling it removes that focus, and since no element *has* focus* you get the error sound. Thats all expected behavior, what are you asking? – BradleyDotNET Dec 15 '14 at 20:15
  • set TabIndex or foces to different control, disable other control afterwards – Max Dec 15 '14 at 20:15
  • A better option would be to use two different forms, one for logging in and one for the actual game window. – Arian Motamedi Dec 15 '14 at 21:13

1 Answers1

0

Set the focus of the control to the textbox you want the cursor to start in.

LarryBud
  • 990
  • 9
  • 20