public PassingValuesSecondForm()
        {
            InitializeComponent();

            passValueEvent += PassingValuesSecondForm_passValueEvent;
            passValueEvent(this, CustomTypeEventArgs.GetCustomTypeEventArgs());
        }
Ejemplo n.º 2
0
        public static CustomTypeEventArgs GetCustomTypeEventArgs()
        {
            if (instance == null)
            {
                instance = new CustomTypeEventArgs();
            }

            return(instance);
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sIdentifier = AssignValueToVariable();

            CustomTypeEventArgs paramContainingUpdatedVariable = CustomTypeEventArgs.GetCustomTypeEventArgs();

            paramContainingUpdatedVariable.stringProperty = sIdentifier;

            PassingValuesSecondForm obj = new PassingValuesSecondForm();

            obj.Show();
        }
 public void PassingValuesSecondForm_passValueEvent(object sender, CustomTypeEventArgs e)
 {
     //this value which was loaded in the previous form is available to be used in this form from the start
     //as the local variable was assigned the very same value as loaded in the previous form in the constructor of the form.
     valueToBeAssigned = e.stringProperty;
 }