|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Activate mdiChildren sub from mdiParentHi to all,
Im a new user of this group. I have a mdiParent form with a toolbar that contains some buttons. One of this button have to activate the function "click" of a button located into the mdi child form. How can i do? Thanks to all, Kamme
Show quote
Hide quote
"carmelo.orla***@eurotel.it" wrote:
> Hi to all, > Im a new user of this group. I have a mdiParent form with a toolbar > that contains some buttons. One of this button have to activate the > function "click" of a button located into the mdi child form. How can i > do? > Thanks to all, > Kamme > > Sorry, hit post accidentally...
Kamme - By nature, your "click" events are private to the form you are working with, so they can't be "seen" by outside classes or modules. While you could just change the scope of the method for the event to Public and then call to ChildFormName.Button1_Click, I don't personally like that method. As you didn't state which version of VB you are using, I'll write this for the lowest common programming denominator: The steps to make this work are: 1) Create a Public Sub to handle your button click on the child form. 2) Move your code from the button's _Click event to the Public Sub in step 1. 3) Call the Public Sub from step 1 in your button's _Click event. 4) Call the Public Sub in step 1 from the MDI Parent. In your child form button _Click event, take all the code out and place it into a Public Sub as such: Public Sub HandleButtonClick() 'Put your button click code here End Sub In your button's _Click event, call the "HandleButtonClick" code: Private Sub Button1_Click() HandleButtonClick End Sub In your MDI Parent, call the "HandleButtonClick" code by referencing your child form: ChildFormName.HandleButtonClick This should work for you. The parameters for your event may be different depending on what language your using, such as: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click I hope this helps! - Jay |
|||||||||||||||||||||||