DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Getting a button's code to run programatically (http://www.daniweb.com/forums/thread89390.html)

bajanpoet Sep 12th, 2007 12:36 pm
Getting a button's code to run programatically
 
I have a button that when pressed displays all the customers in the table. Other buttons are used to add or delete a customer record, or upload a batch of numbers. How can I fire the Click event of the View button after the Add or Delete buttons code has been executed? For example, this is the code for the Upload button

 Private Sub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
    AddBatch(LocationCode, filename)
    BuildScript()
    SaveScript()
    UploadScript()
 End Sub

I want the code that is in my view button to execute after my UploadScript() Sub. Any ideas?

kb.net Sep 12th, 2007 1:10 pm
Re: Getting a button's code to run programatically
 
Hi,

Add the below code within your sub where xxx is the name of the button you want to click:
xxx.PerformClick()

bajanpoet Sep 12th, 2007 1:17 pm
Re: Getting a button's code to run programatically
 
Perfect! Thanks a lot!


All times are GMT -4. The time now is 2:21 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC