473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Handles clause requires a WithEvents variable

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


Jul 12 '07 #1
2 5756
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>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"dancer" <da****@microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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


Jul 12 '07 #2
Do I get rid of the Handles clause?
"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:uw**************@TK2MSFTNGP04.phx.gbl...
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>
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"dancer" <da****@microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>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



Jul 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Berend | last post by:
I am trying to pass multi values into a where clause with an in clause in a store procedure to use in a Crystal report. This can change depending on the user. Maybe there is another way to pass...
5
by: Bradley Grant | last post by:
I am trying to write a program to access a device through USB port, there is some Visual Basic program examples that work with the device, but I am trying to write a program using C#, no luck yet,...
3
by: Sean | last post by:
HI There, I am trying to submit a form when a selection is made from a dropdown list, I keep getting the error "Handles clause requires With Events Variable". Could someone help me with the...
2
by: Moe Sizlak | last post by:
Hi, I am trying to create an custom event to fill an image control, I keep getting the error "Handles clause requires a WithEvents variable." What am I missing? Moe Private Sub...
27
by: Chris, Master of All Things Insignificant | last post by:
I have come to greatly respect both Herfried & Cor's reponses and since the two conflicted, I wanted to get some clarification. My orginal post: Herfried, maybe your example here can get you to...
12
by: johnb41 | last post by:
This question is regarding the "Handles" part of a routine, for example: Handles Button1.Click On Form2 (a User Control) I have a button. Here's it's code: Public Sub Button1_Click(ByVal...
5
by: bokiteam | last post by:
Hi All, I didn't use a "Handles" keyword in VB6. I can't sure its funciton. Does it mean that any object behind "handles" keyword will run the same code? ex: Private Sub A(ByVal sender As...
0
by: Mark C. Stock | last post by:
"Mark C. Stock" <mcstockX@Xenquery .comwrote in message news:... | | "Berend" <Berend.Brinkhuis@evatone.comwrote in message | news:bdd9ac20.0401271301.22cdb65e@posting.google.com... | | I am...
12
by: =?ISO-8859-1?Q?Ren=E9?= | last post by:
Hi, is there a rule of thumb what is better/faster/more performant in SQL Server 2005? a) SELECT * FROM A INNER JOIN B ON B.ID = A.ID AND B.Cond1 = 1 AND B.Cond2 = 2 b) SELECT * FROM A INNER...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.