Well, if Form1 is the only one that can spawn Form2, and is in complete control of Form2, then Form1 directly accessing Form2 isn't a big problem. Especially if you are using the ShowDialog method rather than Show.
What I would do depends on the situation. If Form2 is a Dialog type form, in that when you create it you do something like this:
- Form2 f2 = new Form2();
-
f2.ShowDialog();
Then I would just add a public property to Form2. Something like this:
this is in the class for Form2 - public DateTime MyDate
-
{
-
get { return myDateTimePicker.Value; } //change this to whatever your datetimepicker's name is
-
}
And just grab the value after the dialog is closed.
this is in Form1 where you spawn the form2 - Form2 f2 = new Form2();
-
Form2.ShowDialog();
-
DateTime value = f2.MyDate;
If I were using the Show method rather than the ShowDialog method, and I wanted to know every time that Form2's DateTimePicker changed, I would (in form1) handle the form2 instance's ValueChanged event.