Last post Feb 15, 2021 01:09 AM by SurferOnWww
Feb 14, 2021 09:11 PM|RateFor|LINK
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)
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?
Feb 15, 2021 01:09 AM|SurferOnWww|LINK
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.”