473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Activate mdiChildren sub from mdiParent

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

Jan 13 '06 #1
2 2385


"ca*************@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

Jan 13 '06 #2
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

Jan 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: rat | last post by:
i am having 3 panels(0,1 & 2) in a Statusbar. Using MDI form, i can access and set the text for the panels(0 and 2).. But how can i access the panel(1) from MDI Child form. like...
4
by: DraguVaso | last post by:
Hi, I have a Form which has the property IsMdiContainer = True. So it contains a whole bunch of MdiChilds. Those MdiChilds are all instances of two forms I have: I have some that are an instance...
26
by: Paul Mars | last post by:
FormParent load opens FormChildA. FormChildA btn click opens FormChildB. (FormChildA and FormChildB are both children of FormParent) (FormChildA and FormChildB are different forms) Problem:...
4
by: Ben dotNet | last post by:
FormA is the mdiParent FormB is the child FormC is the Form that is used to open FormB How do I open FormB from FormC (that is not a child) so that it it's mdiParent is FormA? Thanks, --Ben
5
by: juststarter | last post by:
hi there here is my problem : there is a main form (frmMain) which calls a searchForm (frmSearch). Then i select an item (from the returned ones) and open a third form (frmData). Taking from...
1
by: Roy | last post by:
Hi all, I'm opening a mdichild (Form2) within another mdichild (Form1). In Form1 I have: Form2.MdiParent = Me.MdiParent 'No problem here .... .... If Form2.ShowDialog = DialogResult.OK Then 'I...
0
by: Supra | last post by:
i got code working. similar to mirc chat. but what happen when i joined the channel #visualbasic...that fine with me , i got all data coming into first mdichild. but when i joined another channel...
1
by: PDP-8E | last post by:
I'm new to VB.Net 2003 - (2 weeks in) so this MAY be straightforward... (Things changed since Octal Assembler I see !!!) I'll try to lay this out in a way that makes sense I created a...
2
by: carmelo.orlando | last post by:
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...
7
by: Andrus | last post by:
I have UserControls in MDI child forms containing TextBoxes and other controls. When user re-activates form, I need that Control which was last activated is activated again. Currently *first*...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.