Handles clause requires a WithEvents variable

  • Thread starter Thread starter dancer
  • Start date Start date
D

dancer

I get this compilation error:

Handles clause requires a WithEvents variable

I know I need to declare a WithEvents variable, but I don't know how or
where.

Here is a part of the code:
<%@ Page Language="VB" debug="true" %>

<%@ Import Namespace="System.Data.Oledb" %>

<%@ Import Namespace="System.Data.DataSet" %>

<%@ Import Namespace="System.Data.Oledb.OleDbDataAdapter" %>

<%@ Import Namespace="System.IO.StringWriter" %>

<%@ Import Namespace="System.Web.UI.HtmlTextWriter" %>



<script runat="server">

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click


Dim intFileNameLength As Integer
Dim strFileNamePath As String
Dim strFileNameOnly As String

If Not (UploadFile.PostedFile Is Nothing) Then
strFileNamePath = UploadFile.PostedFile.FileName
 
Since you use inline page, you basically can't since members are by the page
parsing/compiling process. Do it by setting OnClick="btnSubmit_Click" on the
<asp:Button>
 
Back
Top