title: Visual Basic 2010/ Sub Procedure
body: <p>I copied the exact codes from my textbook and I have the following errors.</p>
  
  <pre><code>Error   3   'txtOutput' is not declared. It may be inaccessible due to its protection level.    C:\Users\Woong-Sup\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb    13  17  WindowsApplication1
  
  Error   4   'txtOutput' is not declared. It may be inaccessible due to its protection level.    C:\Users\Woong-Sup\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb    15  17  WindowsApplication1
  
  Error   1   Handles clause requires a WithEvents variable defined in the containing type or one of its base types.  C:\Users\Woong-Sup\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb    2   44  WindowsApplication1
  </code></pre>
  
  <p>Could anyone please tell me what the problem is? And I would appreciate if I could add you on my msn and ask some more questions! thanks</p>
  
  <pre><code>Public Class Form1
      Private Sub btnDisplay_Click() Handles btnDisplay.Click
          Dim anyDate As Date
          anyDate = CDate(InputBox("Input a date. (mm/dd/yyyy)"))
          ShowCentury(anyDate)
      End Sub
  
      Sub ShowCentury(ByVal anyDate As Date)
          Select Case anyDate
              Case Is &gt;= #1/1/2000#
                  txtOutput.Text = "twenty-first century"
              Case Is &gt;= #1/1/1900#
                  txtOutput.Text = "twentieth century"
              Case Else
                  txtOutput.Text = "prior to the twentieth century"
          End Select
      End Sub
  End Class
  </code></pre>