title: How to add definition of WithEvents variable which require Handles clause
body: <p>In order to make my program more elegant and better organized in concrete case I would like to change <code>DataGridView1variable</code> with referenced variable on top of my <code>Form1</code> class</p>
  
  <pre><code>Private aDgv As DataGridView
  </code></pre>
  
  <p>And assign value in <code>Form1_Load</code></p>
  
  <pre><code>aDgv = DataGridView1
  </code></pre>
  
  <p>After that I can use <code>aDgv</code> variable across that <code>Form</code>.<br>
  Except in such case:</p>
  
  <pre><code>Private Sub aDgv_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles aDgv.KeyDown
  aDgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect
  'etc...
  End Sub
  </code></pre>
  
  <p>Where I get an error:</p>
  
  <blockquote>
    <p>Handles clause requires a <code>WithEvents</code> variable defined in the containing type or one of its base types.
    And <code>aDgv</code> variable after <code>Handles</code> clause is blue underlined.</p>
  </blockquote>
  
  <p>What to do to get rid of error and get <code>Handles aDgv.SomeEvent</code> to work?<br>
  Of course, with referenced <code>aDgv</code> instead of original control name <code>DataGridView1</code>.</p>