My designer file has this line in it:
Protected WithEvents btnSubmit As Global.System.Web.UI.WebControls.LinkButton
In my code file, I've got this event handler:
Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click
Which gives me an error saying:
Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Structure
On my ASPX page, I'm inheriting SmartpeepsMobi.Personalize
:
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Members/Members.Master" CodeBehind="Personalize.aspx.vb" Inherits="SmartpeepsMobi.Personalize" %>
In my code file, I've put the partial class for the page into a namespace called SmartpeepsMobi:
Namespace SmartpeepsMobi
Public Class Personalize
Inherits System.Web.UI.Page
End Class
End Namespace
I've also put the stuff in the designer file into the same Namespace:
Namespace SmartpeepsMobi
Partial Public Class Personalize
End Class
End Namepsace
This code is copied verbatim.
Despite this structure, I'm getting a lot of errors on ONLY this page:
'txtWeight' 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.
'txtWeight' is not declared. It may be inaccessible due to its protection level.
'txtWeight' is not declared. It may be inaccessible due to its protection level.
'lblmsg' is not declared. It may be inaccessible due to its protection level.
'lblmsg' is not declared. It may be inaccessible due to its protection level.
'lnkCancel' is not declared. It may be inaccessible due to its protection level.
'lblmsg' is not declared. It may be inaccessible due to its protection level.
'lblmsg' is not declared. It may be inaccessible due to its protection level.
'lblmsg' is not declared. It may be inaccessible due to its protection level.
'lblmsg' is not declared. It may be inaccessible due to its protection level.
All of these controls are present in the designer file and in the .aspx page.
I've tried building the project without the files open as per the first answer here.
I added the namespace and checked the inheritance and references as per this answer.
I'm pretty lost here and I feel like I'm out of things to try. Does anyone have any suggestions on a fix?
Thanks in advance!