locked
some of my forms have designers, some don't. Could that cause my error? RRS feed

  • Question

  • User297437924 posted

    I added some files from an old web-site project to a new asp.net web application project.   I get an error: BC30506 Handles clause requires a WithEvents variable defined for some of the forms.   For instance, a button that worked fine in the old version, gives this compile message in the current version.

    So I clicked on 'show all files' in solution explorer, and got the following (see image)

    solution explorer

    If you notice, FormCreateDebate.aspx has a companion file (FormCreateDebate.aspx.designer.vb).   Another form (which is giving me these errors) does not have a designer companion (that form is FormChangePropType).    Could somehow the lack of a designer file create the problem with missing 'withevents'?    If so, why is the designer file missing?

    Thanks

    Sunday, February 14, 2021 9:11 PM

Answers

  • User-1545767719 posted

    Could somehow the lack of a designer file create the problem with missing 'withevents'?    If so, why is the designer file missing?

    Please read the "To copy a Web site project to a Web application project" and "Converting the Project Files" sections in the following Microsoft document:

    Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio

    Here is extraction which will answer to your question:

    “One difference between a Web site project and a Web application project is that in a Web site project, ASP.NET dynamically generates partial classes for ASP.NET Web Forms pages and user controls. After you copy the files from the Web site project to the Web application project, you will notice that the code-behind files for each page and user-control are still associated with the .aspx, .master, and .ascx files. No .designer.cs or .designer.vb files have been generated. As part of the next step, you convert these pages to save their partial classes in a .designer.cs or .designer.vb file.”

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 15, 2021 1:09 AM