locked
Handles clause requires a WithEvents variable defined in the containing type or one of its base types. RRS feed

  • Question

  • User1338949547 posted

    The application is created in 'VS 2010 Ultimate' website model. My operating system is 'Windows 7 Professional'

    which is 64 bit. I have installed SP1 also. During compilation i am getting below errors-

    'Textbox' or label is not declared. It may be inaccessible due to its protection level.

    Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

    Even the text box, label or button exists on aspx page, compiler is not recognising the controls while compiling. Intellisence is working in code behind file for controls.

    Please let me know what i am missing.

    The application is running successfully on client machine.

    I searched over net and found that installing VS 2010 SP1 will correct the error. I have installed the same but no success. Some one suggests that installing the hot fix KB981167 will correct the error . I tried to install the patch KB981167 but getting error as “KB981167 does not apply, or is blocked by another condition on your computer.”.

     

    Wednesday, September 26, 2012 4:13 AM

All replies

  • User397347636 posted

    The 'Handles' error can be fixed by structuring your control declaration like this:

    Public WithEvents myTextBox As TextBox


     

     

    Wednesday, September 26, 2012 11:26 AM
  • User1338949547 posted

    In website model we don't have to specify WITHEVENTS specifically for each textbox. And moreover it is working on client machine. I tried with lots of options as specified in original question but no success as of yet.

    Thursday, September 27, 2012 8:10 AM