R
RP
I have a class file (Global.cs) containing following variable:
Public Int32 TotalRecords=0
I have a Windows Form from where I am assigning a value to this value
as below:
private void SaveRecord()
{
Global objGlob = new Global();
objGlob.TotalRecords=10;
//Open other Form
LeaveRecordForm LeaveRec = new LeaveRecordForm();
LeaveRec.Show();
}
Now, in LeaveRecordForm Load I want to show the value of TotalRecords
in a Text Box.
private void LeaveRecordForm_Load(object sender, EventArgs e)
{
Global objGlobal = new Global();
TextBox1.Text = objGlobal.TotalRecords;
}
The value of TotalRecords being shown is 0 whereas, I assigned it
value 10. Why it is becoming 0?
Public Int32 TotalRecords=0
I have a Windows Form from where I am assigning a value to this value
as below:
private void SaveRecord()
{
Global objGlob = new Global();
objGlob.TotalRecords=10;
//Open other Form
LeaveRecordForm LeaveRec = new LeaveRecordForm();
LeaveRec.Show();
}
Now, in LeaveRecordForm Load I want to show the value of TotalRecords
in a Text Box.
private void LeaveRecordForm_Load(object sender, EventArgs e)
{
Global objGlobal = new Global();
TextBox1.Text = objGlobal.TotalRecords;
}
The value of TotalRecords being shown is 0 whereas, I assigned it
value 10. Why it is becoming 0?