Pass form object value to static method
Posted
by
jrubengb
on Stack Overflow
See other posts from Stack Overflow
or by jrubengb
Published on 2010-12-30T18:02:29Z
Indexed on
2010/12/30
18:54 UTC
Read the original article
Hit count: 187
Hi,
I need to take a form object value and pass it into a static method:
public void SetCalendarStartSafe(DateTime startDateSafe)
{
startDateSafe = calendarStart.Value;
}
private static DataTable GetData()
{
frmMain frm = new frmMain();
DateTime startDate = new frmMain();
frm.SetCalendarStartSafe(startDate);
}
However I keep getting today's current date whenever I try this approach, even if the specified calendar date on the form is different. How can I can the user-specified calendar date from the original frmMain object? Thanks in advance for any guidance.
© Stack Overflow or respective owner