title: Problem with GroupBox when calling member event vb.net 2005
body: <p>I have this class:</p>
  
  <pre><code>Public Class common
  Public Function NumbersOnlyEvent(ByVal CtrlName As String, ByVal type As String, ByVal formName As Object) As String
  
      Dim ctrlType As String = "System.Windows.Forms." &amp; type
  
      For Each objcontrol As Control In formName.Controls
  
          If objcontrol.GetType.ToString = ctrlType And objcontrol.Name.Contains(CtrlName) Then
  
              AddHandler objcontrol.KeyPress, AddressOf NumbersOnlyHandler
  
          End If
  
      Next
  
      Return True
  
  End Function 'NumbersOnlyEvent
  
  Private Sub NumbersOnlyHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
  
      If Char.IsDigit(e.KeyChar) Or e.KeyChar = Chr(8) Then
          e.Handled = False
      Else
          e.Handled = True
      End If
  
  End Sub
   End Class
  </code></pre>
  
  <p>And i have this Form Class:</p>
  
  <pre><code>Public Class addbet
  Dim CommonFunc As common = New common
  
  Private Sub addbet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'AddHandler Events
      CommonFunc.NumbersOnlyEvent("txtSbcNum", "TextBox", Me)
  End Sub
  End Class
  </code></pre>
  
  <p>And i have this textboxes:</p>
  
  <pre><code>txtSbcNum1
  txtSbcNum2
  .
  .
  .
  txtSbcNum15
  </code></pre>
  
  <p>When I add an eventhandler by calling <strong>CommonFunc.NumbersOnlyEvent("txtSbcNum", "TextBox", Me)</strong> on Form_Load, it works fine. But when I place my textboxes on a GroupBox, it doesn't work but when I remove it again to GroupBox it works again. Did i missed something?</p>