title: listen to Keyboard input
body: <p>I have a vb 6 program in which the form opens up like a power point slide I created a textbox for getting keyboard inputs like esc, left key, right key, up key or down key just like in MS Powerpoint. However when adding many controls to the form the user might click on any of them and the keycode attached to my textbox control (which I called cmdline) the will not work unless I add another code to the other controls to force focus of the cursor to the cmdline </p>
  
  <pre><code>Private Sub cmdline_KeyDown(KeyCode As Integer, Shift As Integer)
          'Space Key
          If KeyCode = 32 Then
              cmdPlay_Click
          End If
  
           'Page Up Key
          If KeyCode = 33 Then
              showFirstStanza
          End If
  
          'Page Down Key
          If KeyCode = 34 Then
              showLastStanza
          End If
  
          'End Key
          If KeyCode = 35 Then
              showLastStanza
          End If
  
          'Home Key
          If KeyCode = 36 Then
              showFirstStanza
          End If
  
          'Left key
          If KeyCode = 37 Then
              SavedThis = SaveSettings("projection_font_size", SiteSettings("projection_font_size") - 2)
              lblSongText.FontSize = SiteSettings("projection_font_size")
          End If
  
          'Up Key
          If KeyCode = 38 Then
              cmdPrev_Click
          End If
  
          'Right Arrow
          If KeyCode = 39 Then
              SavedThis = SaveSettings("projection_font_size", SiteSettings("projection_font_size") + 2)
              lblSongText.FontSize = SiteSettings("projection_font_size")
          End If
  
          'Down Arrow
          If KeyCode = 40 Then
              cmdNext_Click
          End If
  
          'Key C
          If KeyCode = 67 Then
              fonttypez = fonttypez - 1
              Select Case fonttypez
              Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
                  font_type_tosave
              Case Else
                  fonttypez = 13
                  font_type_tosave
              End Select
                  font_type_int
                  lblSongText.FontName = SiteSettings("projection_font_type")
          End If
  
          'Key V
          If KeyCode = 86 Then
              fonttypez = fonttypez + 1
              Select Case fonttypez
              Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
                  font_type_tosave
              Case Else
                  fonttypez = 13
                  font_type_tosave
              End Select
                  font_type_int
                  lblSongText.FontName = SiteSettings("projection_font_type")
          End If
  
          'Key X
          If KeyCode = 88 Then
              kala = kala + 1
              Select Case kala
              Case 1, 2, 3, 4, 5, 6, 7, 8
                  SavedThis = SaveSettings("preffered_theme", kala)
              Case Else
                  kala = 1
                  SavedThis = SaveSettings("preffered_theme", kala)
              End Select
                  SetProjectionTheme
          End If
  
          'Key Z
          If KeyCode = 90 Then
              kala = kala - 1
              Select Case kala
              Case 1, 2, 3, 4, 5, 6, 7, 8
                  SavedThis = SaveSettings("preffered_theme", kala)
              Case Else
                  kala = 1
                  SavedThis = SaveSettings("preffered_theme", kala)
              End Select
                  SetProjectionTheme
          End If
  
          'Add Key
          If KeyCode = 107 Then
              SavedThis = SaveSettings("projection_font_size", SiteSettings("projection_font_size") + 2)
              lblSongText.FontSize = SiteSettings("projection_font_size")
          End If
  
          'Subtract Key
          If KeyCode = 109 Then
              SavedThis = SaveSettings("projection_font_size", SiteSettings("projection_font_size") - 2)
              lblSongText.FontSize = SiteSettings("projection_font_size")
          End If
      End Sub
  </code></pre>
  
  <p>Does any one have a code that can help me get keyboard input without having a control attached to it. </p>
  
  <p>By the way using a menu is very cool since the keyboard input will be captured easily no matter which control is focussed. By I dont want to use the menu on this form unless if it can be hidden.</p>