Solved

Passing the correct parameters to a controls click event vb.net 2003?

Posted on 2007-03-27
3
187 Views
Last Modified: 2010-04-23
Experts, I am trying to execute a controls click procedure from inside another procedure, but I am not sure what to pass as the system.eventargs

For example: what do I pass to the radio buttons click event below to fire it from another procedure?

'Here is the click event I am trying to call from a different sub procedure
 Private Sub Opt_Retail_Export_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Opt_Retail_Export.Click
'Do some code
End sub

'This is what i am trying to do

sub run_radio_clicks
opt_retail_export_click(opt_retail_export, opt_retail_export.performclick)
End Sub
     
   
0
Comment
Question by:tentavarious
  • 2
3 Comments
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 18803187
To fire the click event, you only need to call the PerformClick method on the control....you don't need to call the event handler explicitly.

Sub run_radio_clicks()
      opt_retail_export.PerformClick()
End Sub
0
 

Author Comment

by:tentavarious
ID: 18803219
Ok, thats what I did, I was just curious what would I pass it?
0
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 125 total points
ID: 18803635
The parameters you pass to the function are really only there for your benefit since you're the one calling it.  You can actually send it Nothing as the parameters and it will work fine, as long as you're not depending on the values.  So this:

Button1_Click(Nothing, Nothing)

Is essentially this:

Button1.PerformClick()
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This video discusses moving either the default database or any database to a new volume.

757 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

17 Experts available now in Live!

Get 1:1 Help Now