variable/object passing from 1 form to another form in MSVC++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kenneth6
    New Member
    • Mar 2007
    • 79

    variable/object passing from 1 form to another form in MSVC++

    1. In MSVC++ 2005 Windows Form application, how can i pass the variable from 1 form to another form?
    2. if, in 1 of the forms, i created a class object in constructor, how can i pass the object to another form?
  • pootle
    New Member
    • Apr 2008
    • 68

    #2
    Originally posted by kenneth6
    1. In MSVC++ 2005 Windows Form application, how can i pass the variable from 1 form to another form?
    2. if, in 1 of the forms, i created a class object in constructor, how can i pass the object to another form?

    Hi kenneth6,

    Well, you can pass objects in C++/CLI as handles which are basically pointers. This is the same for both of your questions. You can create the object:

    ClassX^ inst = gcnew ClassX( ... );

    Then you can pass this object to other methods:

    void ClassY::method( ClassX^ param) {
    ....
    }

    Does that answer your question? If not, try explaining a bit more what you would like to do.

    Comment

    Working...