public PassingValuesSecondForm()
        {
            InitializeComponent();

            passValueEvent += PassingValuesSecondForm_passValueEvent;
            passValueEvent(this, CustomTypeEventArgs.GetCustomTypeEventArgs());
        }
예제 #2
0
        public static CustomTypeEventArgs GetCustomTypeEventArgs()
        {
            if (instance == null)
            {
                instance = new CustomTypeEventArgs();
            }

            return(instance);
        }
예제 #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;
 }