-
Nov 20th, 2017, 10:18 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Handles clause requires a WithEvents variable - error
Hello
I am getting a red underline in this line of code in my VS 2017 aspx.vb contact form:
In my contact aspx form, I have
Code:
<button type="submit" class="contact_submitted">Send Now</button>
The error I am getting is that 'a Handles clause requires a WithEvents variable' - I am not too sure what that means.
Thanks for any help.
Steve
-
Nov 20th, 2017, 10:27 AM
#2
Re: Handles clause requires a WithEvents variable - error
The error means that either there is no object called contact_submitted, or (less likely) there an object called that but it isn't declared in a way that allows events.
In this case it seems there is no object called contact_submitted... the code you showed has an object with no name, but has a class of contact_submitted. Try setting the name instead.
-
Nov 20th, 2017, 11:43 PM
#3
Re: Handles clause requires a WithEvents variable - error
It's looking for a button that does not exist. Use server control and change the id to contact_submitted.
Code:
<asp:Button ID="contact_submitted" runat="server" Text="Button" />
- kgc
-
Nov 21st, 2017, 06:50 AM
#4
Re: Handles clause requires a WithEvents variable - error
Originally Posted by KGComputers
Use server control
Oops, how did I miss that!
-
Nov 21st, 2017, 10:57 PM
#5
Re: Handles clause requires a WithEvents variable - error
Oops, how did I miss that!
I guess there's a need to replace your reading glasses..Lol :-D
-
Nov 28th, 2017, 11:07 PM
#6
Thread Starter
Hyperactive Member
Re: Handles clause requires a WithEvents variable - error
Many thanks to you both for your kind replies.
I was still getting a red underline under that final 'Click' (VS cannot find it), so I have replaced it with 'Load'. The error has now gone.
Thanks again
-
Nov 29th, 2017, 12:01 AM
#7
Re: Handles clause requires a WithEvents variable - error
cool! don't forget to mark this thread as resolved!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|