locked
BC30506 Handles clause requires a WithEvents VB file not communicating with ASP WebForm RRS feed

  • Question

  • User-529404833 posted

    I am new to ASP should be a simple solution that I am overlooking cannot seem to get my web form to fire an event?  Double click on the button1 in design view nothing happens.  Button Property Lightning view no joy. Attempt to manually enter code error is generated at build.

    <%@ Page Language="vb" AutoEventWireup="false" CodeBeind="TestPage.aspx.vb" Inherits="SampleSite.TestPage" %>

    <!DOCTYPE html>
    <html xmlns="http://wwww.w3.org/1999/xhtml">
    <head runat="server">
         <title></title>
    </head>
    <body class="WebForm1">
    <form id="form1" runat="server">
    <div>
    <asp: Label id="Label1" runat="server" text="Type Something Here" />
    <asp: TextBox id="TextBox1" runat="server"></asp:TextBox>
    <asp: Button id="Button1" runat="server" Text="Button"/>
    </div>
    </form>
    </body>
    </html>

    Imports Microsoft.VisualBasic

    Partial Class WebForm       'Does not matter if I use Partial Public or Public
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
         'Does not recognize Button1.Click or TextBox1.Text or Label1.Text generates an ERROR BC30506
    End Sub
    End Class

    Any assistance would be greatly appreciated using Visual Studio 2019 ASP Net Application Empty Web Site added web form with Project menu.

    Thursday, December 31, 2020 3:08 AM

All replies

  • User-939850651 posted

    Hi Schlauberger,

    According to your description, I create a simple demo to test your code. But I didn't get the same error. I'm not sure if you changed the control name or other code after building the project.

    Have you checked that the control ID in the aspx page corresponds to the control in design.aspx?

    You could also try to rebuild the project.

    Hope this can help you.

    Best regards,

    Xudong Peng

    Thursday, December 31, 2020 9:11 AM
  • User-529404833 posted

    Wow, deleted application created new and everything functions as expected.  Curious shouldn't the VB Class file be displayed in the Solutions Explorer?  Thanks for the response simple task but major hurdle.

    Thursday, December 31, 2020 12:16 PM