Hello guys, I got this problem.
I have a Window Form project within on it I have 2 Buttons and 1 Label
btSet (button)
btGet (button)
lbResult (label)
When I click on btSet I save the value in other class in a different namespace.
The problem is that when I want to get back the value with the get button, the class is empty.. what I can do to dont lose the saved values:
The return value in the label field its 0. And I really saved a lot of values within the RailLib namespace and when I want to get them back with other button, it seems to be that they are not there anymore.
Preveously I had to move all my classes to RailLib because if I leave them in the same namespace as the form class is I got this error:
The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.
What do you think?
I have a Window Form project within on it I have 2 Buttons and 1 Label
btSet (button)
btGet (button)
lbResult (label)
When I click on btSet I save the value in other class in a different namespace.
Code:
private void btSet_Click(object sender, EventArgs e)
{
RailLib.Alarm aux = new RailLib.Alarm();
aux.AlarmResetMask = 5;
}
Code:
namespace RailLib
{
public class Alarm
{
public int AlarmResetMask;
}
}
Code:
private void btTry_Click(object sender, EventArgs e)
{
RailLib.Alarm aux = new RailLib.Alarm();
lbResult.Text = aux.AlarmResetMask.ToString();
Refresh();
}
Preveously I had to move all my classes to RailLib because if I leave them in the same namespace as the form class is I got this error:
The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.
What do you think?
Comment