I'm working on an aspx page with a couple of forms and gridviews and it works fine. I've added another small form to add some records, almost duplicating what I already have except it's for another table but I get the following build errors on 2 consecutive lines:
1. job.aspx.vb(77,0): error BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types
2. job.aspx.vb(78,0): error BC30451: 'sql_job_material' is not declared. It may be inaccessible due to its protection level.
The code causing this error is as shown, with line 77 being the declaration and the actual statement on line 78.
I have a duplicate procedure for FormView2 and a different table with no errors appearing for this. I've even tried declaring formview3 but of course it tells me this is already declared as 'protected withevents' so it seems it's just one big red herring?
I've looked at various solutions on the web, most of which suggesting a withevents declaration of some sort but why would I need it for this new sub when the others do not?
I've scanned for simple typos etc. but can find nothing. Anyone have any ideas where else I might look for a (hopefully very stupid) mistake please?
Protected Sub FormView3_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles FormView3.ItemInserting
sql_job_material.UpdateParameters("job_id").DefaultValue = Request.QueryString("job_id")