Solved

Raising a click event programmatically

Posted on 2003-12-08
2
442 Views
Last Modified: 2007-12-19
I have an imagebutton:

cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)

How do I raise it's click event within the code behind, specifically, what are the parameters to pass
0
Comment
Question by:tyy8
2 Comments
 
LVL 1

Expert Comment

by:Yarx
ID: 9899536
Well, the sender is whatever triggered the event. But in your case. Most people just pass in the "Me" keyword. As for the event erguments, just use "System.Web.UI.ImageClickEventArgs.Empty" Since you aren't doing anything fancy.

So it would look something like this from within your code.

cmdSubmit_Click(Me, ImageClickEventArgs.Empty)
0
 
LVL 8

Accepted Solution

by:
Dranizz earned 50 total points
ID: 9899541
sender is the object that called the event, then you can put the control object of your button to that parameter. the other is generated

If you want to call that event, and don't use the parameters in the sub of the event then call it this way
cmdSubmit_Click(nothing,nothing)

or
cmdSubmit_Click(cmdSubmit,nothing)

or
  Dim arg As New System.Web.UI.ImageClickEventArgs(10, 20) 'Wich are the position of the mouse when it cliked the button

cmdSubmit_Click(cmdsubmit,arg)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question