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.
Expand|Select|Wrap|Line Numbers
- private void btSet_Click(object sender, EventArgs e)
- {
- RailLib.Alarm aux = new RailLib.Alarm();
- aux.AlarmResetMask = 5;
- }
Expand|Select|Wrap|Line Numbers
- namespace RailLib
- {
- public class Alarm
- {
- public int AlarmResetMask;
- }
- }
Expand|Select|Wrap|Line Numbers
- 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?