473,386 Members | 1,846 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,386 software developers and data experts.

Referencing a control on MDI Parent

I am just moving from VB to C# so I hope this isn't going to be too
obvious... I am trying to reference a control (status bar) on an MDI parent
from a child form and can't seem to get the syntax correct.

I have made the control public on the parent form yet get this to work.

Can anyone point me in the right directions?
Thanks
Nov 15 '05 #1
2 8362
George,

You can't just use the name of the type of the parent form. In VB, a
static instance with the name of the type was exposed.

If I am right, you probably are using the MdiParent property on the form
to get the parent. This will have to be cast to the type of the parent
form, and then you should be able to access it, like this:

// Get the parent control.
MyParentForm pobjForm = (MyParentForm) this.MdiParent;

// Access the control.
TextBox pobjTextBox = pobjForm.TextBox1;

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"George" <ix********@hotmail.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
I am just moving from VB to C# so I hope this isn't going to be too
obvious... I am trying to reference a control (status bar) on an MDI parent from a child form and can't seem to get the syntax correct.

I have made the control public on the parent form yet get this to work.

Can anyone point me in the right directions?
Thanks

Nov 15 '05 #2
Helps a bunch! Thanks
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:OG**************@TK2MSFTNGP12.phx.gbl...
George,

You can't just use the name of the type of the parent form. In VB, a
static instance with the name of the type was exposed.

If I am right, you probably are using the MdiParent property on the form to get the parent. This will have to be cast to the type of the parent
form, and then you should be able to access it, like this:

// Get the parent control.
MyParentForm pobjForm = (MyParentForm) this.MdiParent;

// Access the control.
TextBox pobjTextBox = pobjForm.TextBox1;

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"George" <ix********@hotmail.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
I am just moving from VB to C# so I hope this isn't going to be too
obvious... I am trying to reference a control (status bar) on an MDI

parent
from a child form and can't seem to get the syntax correct.

I have made the control public on the parent form yet get this to work.

Can anyone point me in the right directions?
Thanks


Nov 15 '05 #3

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

Similar topics

10
by: Macka | last post by:
A few pieces of information first: * I have a class called Folder which represents a row of data in a database table. The data access side of things is not an issue. * The table has a parent...
3
by: 2obvious | last post by:
I have a DataGrid containing a TextBox control and a CustomValidator in each row. The CustomValidator fires a function that compares all TextBoxes for equality. The algorithm for comparison is...
4
by: John Spiegel | last post by:
Hi all (again), Next question: I have a Web user control contained in a page. How would I go about referencing the other objects in the page from within the control? One way seems to use...
2
by: Axel | last post by:
Hi, a question about something that seems very simple at first glance: is it possible to reference other controls of a subform in a query window without referencing through the parent form? I...
9
by: Alan | last post by:
Hmmm, I'm not too good with the syntax of referencing a subreport. I have frmInvoice which has the invoice details (e.g. ProductCode, ProductCost etc) in the subform frmInvoiceDetails. I'm trying...
21
by: cmd | last post by:
I have code in the OnExit event of a control on a subform. The code works properly in this instance. If, however, I put the same code in the OnExit event of a control on a Tab Control of a main...
2
by: libsfan01 | last post by:
Hi all How do u reference the id (and also now i think about it the name) of the enclosing div tag of a form element such as a button or div tag (without specifying its name)? I've tried:...
4
by: Steve Hershoff | last post by:
I have two UserControls I'd like to have talk to each other. One of them is contained within the other, in a parent/child relationship. The child control is loaded dynamically (it's declared as a...
3
by: Peter | last post by:
Hi, I have a project with an MDI parent form (Main), which can contain any number of MDI children (Document). The Document form contains several user controls, designed as separate projects and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.