shiki_ilija

I load one form from another and I want the object of the second form to be visible in the main.How to make that.I tried to make public but nothing...

Re: Visual C++ General How make one object to be visible in two froms?

Ramkrishna Pawar

You can make them members of each other(or only one of them can have other as member, depending on your requirement), one of the form class can have the variable which needs to be accessed from another.






Re: Visual C++ General How make one object to be visible in two froms?

SThotakura2

yes, you can make the second form object as a member or first form, and have a public property to access that second form object from main.

Sample code goes like this

Code Snippet

class FirstForm : Form

{

private SecondForm m_SecondForm;

public SecondForm AnotherForm

{

get { return m_SecondForm; }

}

.//..... your code goes here

}

In main access the second form as "m_FirstForm.AnotherForm"

---EDIT

I am sorry I had given a C# code snippet. you can do it in VC++