This is ASP.net related, but since the .vb file is giving me the problem I figure this is the board to post on, sorry in advance if it isn't!

So I'm making a Log in type screen for use in a web browser, and I'm having a little bit of a problem with the attached .vb file. I get an error on the line

'Protected WithEvents submit As New Button'

Error says submit is already declared... Although dropping this line gives me a handler error because of the lack of a WithEvents statement...

Heres the larger picture for your understanding:


Public Class _Default
Inherits System.Web.UI.Page

Protected WithEvents submit As New Button


Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click

Dim strscript As String = "<script language='javascript' src='a.js'></script>"
strscript += "<script>"
strscript += "CustomVal()"
strscript += "</script>"

Page.RegisterStartupScript("strscript", strscript)

End Sub

End Class