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

Passing Data in MDI Parent form and Child Form

Hi and Hello.
Im new at .net framework. Now Im using C# . I have a little problem.
How can I get a value of a text in the mdi parent form to child form.

Example in VB6:

form1.text1.text = MainForm.text1.text

How to convert it to C#
--
To be Happy is To be Yourself
Apr 10 '08 #1
2 9613
The best approach is to create a public (or internal) property that
exposes this, and access the text through the property - i.e.

## in Form1.cs ##

public string CaptionText {
get {return text1.Text;}
set {text1.Text = value;}
}

## in parent ## (where form1 is an instance of Form1)

form1.CaptionText = "abc";

## end ##

That way, the UI details are properly encapsulated inside Form1.

Marc
Apr 10 '08 #2
As far as I know, an MDI container (MainForm) cannot have a control within
it, only MDI children. In general though, you could have code in your Shown
or Load event handlers with in the form1 form that look like this:

Text1.Text = ((MainForm) ParentForm).Text1.Text;
"Saimvp" wrote:
Hi and Hello.
Im new at .net framework. Now Im using C# . I have a little problem.
How can I get a value of a text in the mdi parent form to child form.

Example in VB6:

form1.text1.text = MainForm.text1.text

How to convert it to C#
--
To be Happy is To be Yourself
Apr 10 '08 #3

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

Similar topics

1
by: | last post by:
Is there anyway to update a control held on my main form from a child form? I've tried making the control itself public but I still can't seem to access it
1
by: tdmailbox | last post by:
Is there a vb command that can tell me if I have focus in the child or parent form? Basicly I have a search macro that needs me to have focus to any field in the parent form. If my focus is set...
3
by: Vaughn | last post by:
In my MDI, I have a child form (frm_emp) that on a button click, displays another child form w/ a listview (frm_list). I had two questions: 1) Assuming I already have the emplcode the user...
1
by: Henry | last post by:
If the child form and parent form (MDI form) are in the same name space, I can use MdiParent property to set and get the MDIParent. But if the child form is one project, which generate a DLL, ...
1
by: Tim Wallace | last post by:
noob alert... I have an application using c# that uses MDI. On some of the child windows, I need to open a dialog that will communicate back with the MDI child. I did not see any clear way to...
0
by: Sakharam Phapale | last post by:
Hi All, I am developing an application which works similar to MS WORD. I have a main form which acts as MDI container and I am using a third party menu control so that it looks like XP style...
5
by: kevininstructor | last post by:
I have a ListBox on the main form, in the child form when accessing items I get an error message "Object reference not set to an instance of an object." here is the code in the child form. Is there...
4
by: backups2007 | last post by:
Say for example, i have rows of input textboxes and i would like to pass different data from a popup window. How should I do it?
6
by: backups2007 | last post by:
What I want to do is be able to open a popup window that may pass data to different rows of textboxes of its parent window. I want to pass data to different rows of textboxes and each row has a...
3
Jerry Maiapu
by: Jerry Maiapu | last post by:
Hi all, I have a child and parent forms. The record source of the sub-form is query containing aggregate functions. A combo box in the parent form filters the sub-form results based on value...
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?
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...
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
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...
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.