Click here to Skip to main content
15,902,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two forms form1 and form2.

form1 datepicker1
form2 datepciker1


in the form1 when i choose the date that selected date to be displayed in the form2 datepicker1.

for example;

Form1 Datepciker i choose 21 st january date.


in the Form2 datepicker1 that 21st january to be displayed in the Form2 load event.

how can i do.
Posted
Comments
bbirajdar 30-Jan-13 2:13am    
1. Get the date from the datepicker in Form1 into a Session variable
2. When you move to Form 2, assign the date from session variable to the datepicker in Form 2

You can use delegate and custom event.while moving from form 1 to form 2,call the event.
 
Share this answer
 
U cn achieve this using properties get set method.

Declare get set method in form2 like

C#
DateTime _date;
    public int PickDatetime
    {
    get
    {
        return this._date;
    }
    set
    {
        this._date = value;
    }
    }


Then on form2 load event u cn code

datetimepicker1.value=_date;

And on form1 while calling form2 put following code

form2 obj=new form2();
obj.PickDatetime =datetimepicker1.value;
obj.show();

hope this will help u
plz vote and accept ans if it helps.
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900