Solved

Raising a click event programmatically

Posted on 2003-12-08
2
441 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now