473,387 Members | 3,810 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,387 software developers and data experts.

Windows Forms> How to Control Main_Form from Sub_Form

Hello,

I am developing a project using Windows Forms .NET by using Visual C++ .NET
v2003.
I open a Sub_Form by clicking a button on the Main_Form. Some operations are
working at Main_Form and results of those works are updating the texts and
enable statuses of controls (LabelBox, Buttons, etc.) on the Sub_Form.
I would like to control and update the controls' text, enabled statuses at
Main_Form from Sub_Form.
Let's say my initial form is MDI type (Main_Form). It has a StatusBar and
StatusBarPanels. I open a child form (Sub_Form) by clicking menu option.
Whenever I click a button on Sub_Form, I want to inform the user by changing
the text of a StatusBarPanel on Main_Form (MDI Parent).
I thank your kind guidance in advance.
--
~~~~~~~~~~~~~~~~~~~
İyi Çalışmalar
Alper AKÇAYÖZ (Bil Muh)

Wish You Good Work
Alper AKCAYOZ (Bil Muh)
Nov 17 '05 #1
2 1185
Add a 'Parent' property/member to Sub_Form that is set through its
constructor. Then just use the 'this' keyword as the constructor's parameter.
Nov 17 '05 #2
I think an overloaded constructor, which takes the address of Main_Form as
parameter, should be in the class of Sub_Form. Like below;

SUB_FORM.H
------------------------
#include "Main_Form.h"
....
public __gc class MDI_Child : public System::Windows::Forms::Form
{
...
public:
void Sub_Form(void)
{
InitializeComponent();
}

public:
System::Windows::Forms::Form *frmMain;

//If I state Main_Form as type of a variable, compiler gives error
//How can I include the Main_Form class into Sub_Form ???
void Sub_Form( Main_Form *frm )
{
frmMain = frm;
InitializeComponent();
}
...
}

How can I include the Main_Form class into Sub_Form ?
"Reuben" wrote:
Add a 'Parent' property/member to Sub_Form that is set through its
constructor. Then just use the 'this' keyword as the constructor's parameter.

Nov 17 '05 #3

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

Similar topics

1
by: Jay Douglas | last post by:
Hello, This may be an elementary question, but I'm having a hard time finding a document that answers this question: What order are the events fired on classes / controls inherited from the...
4
by: Carl Fenley | last post by:
I believe I have almost successfully created a custom datagrid control. The new class builds without error. I have added it as reference to the main Windows Application project. It appears on...
2
by: Matt Theule | last post by:
I need to be able to allow users to drag files to a list box on a web page. To this end, I created a Windows Control and hosted it in a WebForm. When the file is dropped onto the listbox, the...
1
by: Chung | last post by:
Hi I am trying to create a Web applicatiion by using windows user control. I am having problem when I trying to load the web page, I got blank screen with a broken image. It is like the web...
0
by: Vincent Mouton | last post by:
Hi, I am having trouble integrating a System.Windows.Forms.Control into an asp.net page. I based my tryout on the sample provided in the quickstart tutorials...
3
by: Dilip | last post by:
Hi I have a windows forms user control that is hosted in IE. This control uses COM Interop to access some RTC related interfaces. The control does not display itself correctly because of this...
2
by: Özden Irmak | last post by:
Hello, Is there an easy way to save some/all properties of a windows forms control into a type of file? I came acros with "Serializable" attribute but it seems that I have to inherit evey...
5
by: Sudharsan | last post by:
Hi I have developed a Windows Control Library in VC.NET The component will play back video files and this component is used in C# applications to display multiple videos simultaneously. The...
0
by: gxl034000 | last post by:
Hi, I have been trying to use a .net Forms control in my webpage to open up an application(notepad) on the client. The control works fine when embedded in a windows form, but I keep getting a...
0
by: Budhi Saputra Prasetya | last post by:
Hi, I still have the same problem with embedding Windows Control. I'll just requote what I posted last time: I managed to create a Windows Form Control and put it on my ASP .NET page. I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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...

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.