I get the error
Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
in the following co
I've gotten this error when for some I've renamed a field. For some reason sometimes the designer messes up and doesn't rename it in the form.aspx.designer.vb file, if you look in there and fix the name it can fix this issue if that has happened to you.
So double check that the field name is the same in your even handler, the aspx file and the designer.aspx files.
I had this error on a handler function for an ASP button on vb.net. Solved by adding
runat="server"
to the enclosing form tag
<form name="formUpdate" method="post" id="frmUpdate" runat="server">
<asp:Button ID="btnUpdate" runat="server" Text="Update" />
</form>
I had encountered this issue when upgrading a legacy page. The problem is in the Inherits attribute @Page directive has the wrong namespace.
I had this happen on the OnClick event for a button. I originally the button inside a panel inside of an ItemTemplate for a gridview column. I only needed the panel to popup on some other buttons OnClick event so I didn't really need it repeated through out the grid. It was hidden anyhow. I moved the panel outside the gridview all together and the error went away.
I encountered this error in a solution while testing something. It is related to Designer.vb related to the form. Make sure that it was updated.
When converting a legacy Web Sites Project to a Web Application Project type, when following these directions, after converting the application, it created a bunch of .aspx.designer.vb files for me but didn't include them in the project. So I clicked on the project root in solution explorer, pressed the * key to expand everything, then multiselected all of the designer.vb files and right-clicked then said 'include in project'. Then it was able to see the types and the compiler lived happily ever after.
THE END