Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

link two buttons 1

Status
Not open for further replies.

clowns119

Programmer
Feb 20, 2005
15
US
Hi I am having a small problom that is driving me a little crazy!! I have 3 forms 2 forms have dubmit buttons on them and when I click a button on my main form I want the events form both those buttons to occur, how can I do this.
Please help!
 
A nice simple solution would be...

Code:
Private f2 As New Form2
    Private f3 As New Form3

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        f2.Show()
        f3.Show()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        f2.Button1_Click(sender, e)
        f3.Button1_Click(sender, e)
    End Sub

where the Button1_Click method are the handlers for the submit button click.

NOTE: Make sure the Button1_Click methods (or whatever you're calling them) are Public so they are exposed to the calling form.

I'm assuming you're not using inheritance which is another option if you find yourself using similar methods and events on forms.
 
I tried it below and it said that my button was notr declared on form1 I have it declared as public shared I am not sure what I Aa m doing wrong
Code:
 Private Sub UpdaterClick(sender As System.Object, e As System.EventArgs) Handles Updater.Click
  		SZLDLG.SZLCLICK(sender,e)
 
C:\mission Tracking\MEF\MainForm.vb(220) : error BC30545: Property access must assign to the property or use its value.

that is the error I get
 
Could you post the code in question, namely the MainForm button click code and the button click for the other forms
 
I figured it out,
I was setting the definition of the button as publick not the onclick class. Once I switched that it worked like a champ, Thanks for your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top