Solved

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

Posted on 2007-03-27
3
208 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

778 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