473,657 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MDI Child Controls question

I have an MDI form with a number of MDIChildren. Each child is identical and
has a single PictureBox on it.

One of the child forms will be the active form. I need to code something
like this:

me.activeMDIChi ld.Picturebox1. Image = "C:\fred.jp g"

which of course I can't do. How do I refer to this control on the active
form?

Thanks

-Jerry
Apr 4 '06 #1
2 1677
Ok there is something ActiveControl for each Form... not sure if you can use
that for a picturebox, because it can't get Focus like a textbox... so what
you can do is the below..

Dim ChildControl As Control
For Each ChildControl In Me.ActiveMdiChi ld.Controls
If TypeOf ChildControl Is PictureBox Then
' do your stuff here..
End If
Next

"Jerry Spence1" <je**********@s omewhere.com> wrote in message
news:44******** *************** @ptn-nntp-reader03.plus.n et...
I have an MDI form with a number of MDIChildren. Each child is identical
and has a single PictureBox on it.

One of the child forms will be the active form. I need to code something
like this:

me.activeMDIChi ld.Picturebox1. Image = "C:\fred.jp g"

which of course I can't do. How do I refer to this control on the active
form?

Thanks

-Jerry

Apr 4 '06 #2
Have a think about the Type (class) of the objects you are dealing with.

The type of Me.ActiveMDIChi ld is System.Windows. Forms.Form. The type of the
object that is actually your MDIChild is whatever name you have given it and
is derived from System.Windows. Forms.Form.

You need to cast Me.ActiveMDIChi ld to whatever your class is before
attempting to access the controls on it.

e.g.:

CType(Me.Active MDIChild, <myclass>).Pict urebox1.Image = "C:\fred.jp g"
"Jerry Spence1" <je**********@s omewhere.com> wrote in message
news:44******** *************** @ptn-nntp-reader03.plus.n et...
I have an MDI form with a number of MDIChildren. Each child is identical
and has a single PictureBox on it.

One of the child forms will be the active form. I need to code something
like this:

me.activeMDIChi ld.Picturebox1. Image = "C:\fred.jp g"

which of course I can't do. How do I refer to this control on the active
form?

Thanks

-Jerry

Apr 5 '06 #3

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

Similar topics

8
4928
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender, System.EventArgs e) { MessageBox.Show("keyboard button pressed!"); } Following is the code to load the frmTestBaby
3
6349
by: poi | last post by:
In VS.NET 2003, I get intellisense if I do this: LiteralControl literalControl = new LiteralControl(); literalControl.ID = "something"; literalControl.Controls.Add..... And it compiles fine but I get an error saying that the LiteralControl does not allow child controls.
3
7716
by: Arulraja | last post by:
Hello, I have created 2 custom server controls, The parent custom control contains multiple child custom controls. The Child control has a button on it. If I Click the button control, it calls the Parent controls CreateChildControls() method before calling the child control's button click event. Because of this behaviour, I am not getting the changes I made in the
4
1068
by: wASP | last post by:
Hi, I was under the impression that, when ASP rendered a page, it recursively traversed the hierarchy, executing all controls in each ControlCollection of every control in that hierarchy. I tried adding a Button control to a TextBox ControlCollection, and it didn't execute. When I add the control to the Placeholder ControlCollection (after the TextBox control is added), it executes without any problem:
3
3203
by: Lance | last post by:
I've noticed that controls that are contained in MDI child forms fail to raise MouseLeave events if the MDI child form's MdiParent property is set to Nothing (after it was set to an existing MDI container form) or if the MDI child form's Visible property is set to False (after the MDI child form was shown). This is an enormous problem for my app because I must show different MDI child forms based on the state of my application and many of the...
10
4008
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
4
3622
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if possible.. for example..i hav a menu in the parent form named "Administrator" whic has an item "mnuLogIn"..now when i click on login..another child form named "frmLogIn" is displayed..what i want to happen is this: when login form(frmLogIn) is...
4
3560
by: Richard Lewis Haggard | last post by:
What is the mechanism by which a child window can notify its parent that it has been clicked on? -- Richard Lewis Haggard www.Haggard-And-Associates.com
5
2241
by: Earl | last post by:
I need to call a method on an owned child form, and am wondering if the best way of doing this is to capture the Closing event of the form that passes control back to the form where I have the method. The structure is like so: frmMain (MDI, runs on app start) calls frmB (MDI child), which in turn calls frmC (MDI child), which in turn calls frmD (MDI child). frmMain and frmB remain open while frmC and frmD are shown.
1
14552
by: sklett | last post by:
I've read several articles/blogs/threads about anchoring/docking child controls in a FlowLayoutPanel. It sounds like it *should* work, but I can't get it to work for the life of me. Jon Skeet: I've created a short and complete sample to illustrate the problem. Beat you to it! :0) I would really appreciate if anyone could take a look at this and tell me what the magic trick is to make this work. All I want is to have the child...
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.