lets say i have a group of variables in a Struct called Stats. i've made an instance of Stats, player, in Form1. How would i be able to use the same values of player in Form2?
This is a discussion on passing a Struct from one Form to another? within the Windows Programming forums, part of the Platform Specific Boards category; lets say i have a group of variables in a Struct called Stats. i've made an instance of Stats, player, ...
lets say i have a group of variables in a Struct called Stats. i've made an instance of Stats, player, in Form1. How would i be able to use the same values of player in Form2?
Have Form2 get a reference or pointer to Form1 or make a reference or pointer to the struct in Form2 or make a new struct in Form2 and assign it from Form1.
Possibilites are endless.
Oh, and Cielo is using .NET, as well, so everyone is aware.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
hm you may have misread that because i have no struct in form2, only form1. i want to be able to use the values of the struct from form1 in form2.
and you said "make a new struct in Form2 and assign it from Form1," but thats exactly what i wanna know how to do... i wanna know how to assign values from Form1 into variables in Form2
I'm going to move this to the Windows board since CLI and .NET are more about Windows than C++.
How are form1 and form2 related?
Pass the data from form1 to the parent when form1 closes, then to form2 when it is created.
We need more info to tell you how to do this.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Something like this, Cielo:
So when you create your form, you create it like this:Code:class Form2 { public Form2(struct Stats *pStats) { stats_ = pStats; } private struct Stats *stats_; };
Code:Form2 *form2 = new Form2(&stats); // assuming stats isn't already a pointer