A
Allen
I am making a program with 3 forms(classes). 1)Form1, 2) Employee, and 3)
EmployeeInOu. I am using MS VS 2008.
They all inherit from “System::Windows::Forms::Formâ€.
My problem is I want to access variable “tempâ€, which belongs to EmployeeID
class, in a different class which is EmployeeInOu.
Below are some skeleton codes to show the 3 classes. I hope someone can
help.
//Class(1):
public __gc class Form1 : public System::Windows::Forms::From {
public:
Form1(void)
private: System::Void EmpMenuItem_Click(System::Object * sender,
System::EventArgs * e)
{
//Create
EmployeeID* box = new EmployeeID();
//Fill
box->EmpNum = S""; //set is used
//Show
if (box->ShowDialog() == DialogResult::OK)
{
box->EmpNum; //get is used
}
}
};
//Class (2):
public __gc class EmployeeID : public System::Windows::Forms::Form
{
public:
private: System::Windows::Forms::TextBox * empNumBox;
public:
__property void set_EmpNum(String* p){empNumBox->Text = p;}
__property String* get_EmpNum() {return empNumBox->Text;}
private: System::Void OKBtn_Click(System::Object * sender,
System::EventArgs * e)
{
//Create
EmployeeInOut* box1 = new EmployeeInOut();
//Fill
int temp = System::Int32:arse(EmpNum);// I want to use “tempâ€
}
};
//Class (3):
ublic __gc class EmployeeInOut : public System::Windows::Forms::Form
{
public:
EmployeeInOut(void)
{
private: System::Void OutBtn_Click(System::Object * sender,
//OUT
System::EventArgs * e) //OUT
{
//Create
EmployeeInOut* box1 = new EmployeeInOut();
//Fill
switch (temp)//---- I want to access temp from the 2nd class to use in(let
say switch) the 3rd class
{
}
EmployeeInOu. I am using MS VS 2008.
They all inherit from “System::Windows::Forms::Formâ€.
My problem is I want to access variable “tempâ€, which belongs to EmployeeID
class, in a different class which is EmployeeInOu.
Below are some skeleton codes to show the 3 classes. I hope someone can
help.
//Class(1):
public __gc class Form1 : public System::Windows::Forms::From {
public:
Form1(void)
private: System::Void EmpMenuItem_Click(System::Object * sender,
System::EventArgs * e)
{
//Create
EmployeeID* box = new EmployeeID();
//Fill
box->EmpNum = S""; //set is used
//Show
if (box->ShowDialog() == DialogResult::OK)
{
box->EmpNum; //get is used
}
}
};
//Class (2):
public __gc class EmployeeID : public System::Windows::Forms::Form
{
public:
private: System::Windows::Forms::TextBox * empNumBox;
public:
__property void set_EmpNum(String* p){empNumBox->Text = p;}
__property String* get_EmpNum() {return empNumBox->Text;}
private: System::Void OKBtn_Click(System::Object * sender,
System::EventArgs * e)
{
//Create
EmployeeInOut* box1 = new EmployeeInOut();
//Fill
int temp = System::Int32:arse(EmpNum);// I want to use “tempâ€
}
};
//Class (3):
ublic __gc class EmployeeInOut : public System::Windows::Forms::Form
{
public:
EmployeeInOut(void)
{
private: System::Void OutBtn_Click(System::Object * sender,
//OUT
System::EventArgs * e) //OUT
{
//Create
EmployeeInOut* box1 = new EmployeeInOut();
//Fill
switch (temp)//---- I want to access temp from the 2nd class to use in(let
say switch) the 3rd class
{
}