473,383 Members | 1,870 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,383 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 9609
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.