-
February 22nd, 2010, 11:07 AM
#1
[RESOLVED] Save SetDate
I display a calendar in my windows form with a particular date highlighted on it:
Code:
calBirthDate.SetDate(lTrainee.BirthDate);
The user then has the possibility to manually change this highlighted date. On saving I want this newly highlighted date to be saved. How do you set the date for setDate()? I tried the following but it didnt work:
Code:
lTrainee.BirthDate = (DateTime)calBirthDate.SetDate.Value;
-
February 22nd, 2010, 11:30 AM
#2
Re: Save SetDate
Originally Posted by stephsh
I tried the following but it didnt work...
1. Do you get a build error?
2. Do you get a run-time error?
3. Have you checked the value of the calBirthDate.SetDate property at run-time?
-
February 22nd, 2010, 11:36 AM
#3
Re: Save SetDate
I received a build error so I didnt try to debug it. The first setDate() methods works fine
-
February 22nd, 2010, 11:54 AM
#4
Re: Save SetDate
I assume you're using the MonthCalendar control. Seems like a funny control. Have a loot at this link MonthCalendar.SelectionRange...
-
February 22nd, 2010, 12:39 PM
#5
Re: Save SetDate
Thanks, that helped! I kept looking at the code on the MSDN library for setDate() but didnt read the remark that this is just assigning the same value to both selectedRangeStart and selectedRangeEnd. I should therefore be able to use the following code:
Code:
lTrainee.BirthDate = (DateTime) calBirthDate.SelectionRange.End;
-
February 23rd, 2010, 08:35 PM
#6
Re: [RESOLVED] Save SetDate
Even neater...
Code:
// Form Initialisation
clBirthDate.MaxSelectionCount = 1;
// Event DateSelected
lTrainee.BirthDate = calBirthDate.SelectionStart;
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
-
February 24th, 2010, 05:10 AM
#7
Re: [RESOLVED] Save SetDate
Thank you, it works perfectly!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|