Geeks With Blogs

News
View Szymon Kobalczyk's profile on LinkedIn

Szymon Kobalczyk's Blog A Developer's Notebook

Not long ago I came across some cool demos showing new features in Windows Forms 2.0. Some of these show how to emulate look and feel of some well know applications (like MS Outlook, Money, Quicken, File Explorer or MSN Messenger). In particular I found there an interesting example of customizing the DataGridView control to implement multi-view schedule component emulating the Outlook Calendar. This sample supports rendering calendar events in day, week and month view. I think it would be quite interesting for anyone who needs to implement some custom rendering or behavior in this control.

Recently it turned out I could find some use for a month schedule, so after tinkering with the sample for a while I was able to extend it to fulfill my needs. Below you can see how it turned out and what changes I’ve made.

calendar screenshot
  • Added row headers with week numbers,
  • Added fancy row and column headers,
  • Enabled to select specific appointments with mouse and from code,
  • Month name on first cell and first day of month,
  • Different colors for current month and previous/next one.

Generally this was quite easy and fun to accomplish and really shows how well designed is the DataGridView control (especially when compared to old DataGrid). Of course it lacks many features that you can find in professional components like DevExpress XtraSchedule or Infragistics’ UltraWinSchedule, but I think it is sufficient in many simple cases.

Updated 29-01-2006

Wow. I didn't expect my little sample will even interest single person. I already received more then 20 requests to send source code and I slowly loose track to whom I sent it or not. Therefore I decided to release it to ProjectDistributor for everyone. So if you still want to see how this was made please help yourself and get the source code.

There are two changes in this release:

  • Added cell overflow indicators.
  • Fixed rows autosizing.

I hope you enjoy it, and don't forget to let me know what you think of it.

Updated 31-12-2007

Because the ProjectDistributor site is down I've moved the code to SkyDrive MSDN Code Gallery:

Download the source code

Posted on Monday, January 2, 2006 3:43 PM Development | Back to top


Comments on this post: Poor Man's Schedule Component for Windows Forms

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Nice work! I'll be glad to see the source code. Please publish it or send it to marcos@2winsystems.com
Left by Marcos Tabaj on Jan 02, 2006 6:14 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I'll also be glad to see the code
Left by Andrzej on Jan 11, 2006 6:10 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Andrzej,
Put your email in comment or write to me via "Contact" link on the left so I can send you the code.
Left by Szymon on Jan 11, 2006 10:24 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Hello Simon

Is it still possible to get a copy of the code - thanks Renee
my email is hotmail@renee_milla.com please swap left and right part of email as you may have guessed (:
Left by Renee on Jan 20, 2006 4:54 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Excellent job!

Since I'm a VB developer I put your 5 calendar classes into a separate C# class library project, added the project to my VB winforms solution, referenced the Calendar project then dropped the control on my form. It's excellent and does not cause the errors I was having with the Outlook Calendar Look and Feel app I downloaded from Microsoft at www.windowsforms.net/Default.aspx?tabindex=4&tabid=49 . I was able to get the calendar date using this code:

Private Sub Calendar1_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Calendar1.CellDoubleClick

Dim cal As Calendar = DirectCast(sender, Calendar)
Dim dc As DayCell = CType(cal.CurrentCell, DayCell)

MessageBox.Show(dc.StartTime.ToLongDateString)

End Sub

I'd be interested in learning other tips, tricks or features relating to your component. This is a control I've been looking for.

Thanks!

Left by DeveloperDan on Jan 25, 2006 6:27 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Could you please send also to me the source code? Thanks Kboy
My email is: groumpi@freemail.hu
Left by Kboy on Jan 28, 2006 7:09 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great control!!

The only thing it seems to not be able to handle is multi day events. Is this a limitation of the grid or is it something you are planning to add.

Anyway... great job!

Thanks!!
Left by RedEye on Feb 19, 2006 3:09 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great job!
Could you please send also to me the source code? Thanks!
My email is: xue7xiao@hotmail.com
Left by Jonny on Mar 09, 2006 12:35 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Left by Szymon on Mar 09, 2006 5:50 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Maybe there is something I am overlooking but the CellContentClick does nothing.

I have run my app and your app in debug mode with a break point on the following and the event is never raised. Any ideas?

private void calendar1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}

I was going to dive into the code but I though I would ask before I spend any time on it.

Thanks
Left by RedEye on Apr 08, 2006 12:13 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
this is may Email Address
orland_frias@yahoo.com

Thnkx
Left by Orland Frias (ph) on Jul 14, 2006 4:55 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Hi,

This looks like a great component, where can I download it?
Left by Chris on Aug 24, 2006 9:32 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Thank you for a great component!

I´ve been looking for days after something like this for my little project since I don´t have the time to make one myself.

Again thanks
Left by Jocke on Oct 20, 2006 3:01 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Could someone please explain how to use this control in a VB2005 project? Thanks...
Left by nick on Nov 06, 2006 6:19 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I would love to get this schedule.. my email is jrahma@yahoo.com

...thaks
Left by Jassim Rahma on Dec 23, 2006 5:01 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I would like to get the schedule.
Email: hydie627@yahoo.com.hk

Thanks!
Left by Hydie on Feb 15, 2007 6:32 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Left by Szymon on Feb 15, 2007 8:54 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Maybe I'm missing something but as a new .NET VB developer I have no idea how to add this code into my VB project as a usable control. Is there a guide somewhere? I would like to use this and give some feedback on it.
Left by Adam Wilson on Feb 20, 2007 7:22 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Left by Adam Wilson on Feb 20, 2007 10:50 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Is there a code for VB 6
Left by Jad on Mar 24, 2007 8:13 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Its really Quiet interesting
Left by hari on Jul 09, 2007 12:40 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Do you have any examples on how to use the code? For example, how to add an Appointment to the Calendar?
Left by Toma on Jul 18, 2007 9:19 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Maybe there is something I am overlooking but the CellContentClick does nothing.

I have run my app and your app in debug mode with a break point on the following and the event is never raised. Any ideas?

private void calendar1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}

Can u please help me how to get cell click event.

Thanks
Left by Shweta on Sep 19, 2007 2:01 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Is there another link to the code? The ProjectDistributor site is down.

Thanks
Left by E.Neu on Dec 21, 2007 3:31 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I've moved the file to SkyDrive - look for the new linka above.
Left by Szymon on Dec 31, 2007 11:39 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Still not working correctly. Zipped file is corrupt.
Left by JJ on Jan 05, 2008 10:00 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Amazing control. I must say it is exceptional work. I just have a question. Can you let me know what to do change to day /week view. From the comments above I felt it is supported.

Please let me know?
Himanshu
Left by Himanshu on Jan 09, 2008 5:10 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Hi,

Thats a real good control.

I had downloaded your source code and able to run it but after loading the project i am not able to add any data to the cell.

Please tell me what to do. I want to use this control.
Left by Jats on Mar 11, 2008 12:20 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Hi,

great control. Worked from the beginning! One question: How could I add an event handler that would act on a mouse-click on the appointment? (Not only the day cell that may have several appointments).

Thanks,

Jon
Left by Jon on Mar 19, 2008 9:05 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Can you let me know how do change to day /week view??
Left by rex on Mar 31, 2008 10:19 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great control, exactly the kind of thing I was looking for.
Thank you for sharing
Left by Gunter on Apr 11, 2008 12:14 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Nice job!

How I can use only one weeek against 6?
Left by Jesus Campos on Sep 16, 2008 4:28 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Nice work!
Left by Sameer C Thiruthikad on Sep 22, 2008 7:26 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I have a database that contains events throughout the month. How can I use this great control and populate the events from my database into the days on the calendar?
Left by Marion on Jan 05, 2009 3:21 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Hi there! This looks just what I am after. I have been using the other calendar control from WindowsClient.net and managed to get it all working - but it doesn't draw well enough!

I have followed the link to get the source code for this, but it's not there, any chance someone can email it to me?

Thanks in anticipation - fingers crossed.

Johno.
Left by m900349 on Feb 08, 2009 10:00 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I managed to find it on the above link! Thanks.

May try and alter to work on weeks as this is better for my requirement but thanks! :)
Left by m900349 on Feb 09, 2009 12:28 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
How can I hook this up to my dataset, and also can I add multi day events?
Left by tg on Mar 17, 2009 7:21 PM

# Good Work
Requesting Gravatar...
Very very good work, this calendar helps me a lot !!!!!!!

Thanks !
Left by Timm on Apr 21, 2009 3:31 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Very good control!
However I have a problem with CellContentClick event. Looks like it does nothing. I put a breakpoint on calendar1_CellContentClick method but it's not fired when I click on appointment. Maybe I'm doing something wrong?

Second question about an icon that appears in right, lower corner of a cell when adding new appointments. Is it usable?
Left by Marcin on May 31, 2009 5:16 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...

Hi,
I m using Calender lib control. It is very nice control.
But Its disply only one month calender. I want to display all the days from the selected range,
like From 1st Jan 2009 to 31 st may 2009. How to do this?
Can u please mail me the solution for this to shilpa.korgaonkar@live.com
Left by ab on Jun 01, 2009 8:54 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
This is great control!!!

Well done dude :-D!!!
Left by Pablo on Jul 16, 2009 1:33 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I've moved the file to SkyDrive - look for the new linka above.
Left by perde modelleri on Apr 11, 2010 9:22 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I always knew datagrid (never used them) could be modified to accomplish this task. Thanks a lot!
Left by analog_ on May 10, 2010 1:17 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great Control!!! I do have a couple of questions. How do you reference the "Overflow Indicator"? I find no reference to it. Second, How do you reference the date from a blank cell? In other words, I'd like to click on a blank cell and have it take me to a secondary form to enter an appointment with the date already populated. I find no reference for "Selected Date" only "Selected Appointment". I did overcome the multiple days by iterating through my dataset and using code similar to this if anyone is interested:

For Each ueRW As DataGridViewRow In Me.mydatagridview.Rows 'datagrid view is hidden behind cal
Try
Dim uect As Integer = DateDiff(DateInterval.Day, ueRW.Cells(3).Value, ueRW.Cells(4).Value) ' to get the range of dates
Dim uedt As Date
Dim uec As Integer = 0
Do

uedt = DateAdd(DateInterval.Day, uec, ueRW.Cells(3).Value)
Dim appt4 As New Appointment
appt4.StartTime = uedt
appt4.EndTime = uedt
appt4.Text = 'my text here
appt4.BackColor = Color.Snow
Calendar1.CalendarEvents.Add(appt4)
appt4 = Nothing
uec = uec + 1
Loop Until uect = uec - 1
Catch
End Try
Next

sorry for the crudeness, but it works perfectly.

Thanks for any help anyone can give.
Left by Snoopy33 on Jun 17, 2010 4:59 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Is it possible to download a binary dll instead of the source? I am using VCExpress for C++.
Left by RK on Jun 21, 2010 7:02 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great control!
One problem I am facing is my appointment text is not fitting into the columns.
How can I get a tooltip (on mouse over) of the appointment text?

Thanks
Left by San Kochi on Jul 14, 2010 10:26 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
I want oulook scheduler calender control in my windows form vb.net code plz send to above specfied mail
Left by Rajkumar on Aug 04, 2010 1:37 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
HI, Any component like with time and minutes scheduling
Left by palani on Sep 26, 2010 11:48 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
This is really useful thankyou.
Left by joshua on Jul 05, 2011 3:09 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Very Good document.Thank you for sharing us.
Left by dell destek on Jul 21, 2011 8:34 AM

# Thx!
Requesting Gravatar...
Sharing is very beautiful and high quality
Left by lahmacun firini on Jul 21, 2011 10:02 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
sharing is very beatiful thanks
Left by dell servis on Jul 21, 2011 1:42 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
sharing is very beautiful and high quality
Left by fuar standı on Jul 21, 2011 4:56 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
sharing high-quality and beautiful.

thx :) ..
nice site
Left by simit fırını on Jul 22, 2011 8:09 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
sharing is very succesfull and high quality
Left by rögar on Jul 25, 2011 9:38 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great presentation but how do you add the notes to the days?
Left by Mike on Jul 26, 2011 10:43 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
help me, I Want to have the same source code, but in vb.net 2010 thanks to
Left by Igor on Mar 19, 2012 8:56 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Great stuff, good quality and clear code!
Left by Christian S on Apr 03, 2012 9:40 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Nice work! I'll be glad to see the source code but in vb.net window forms and sql server. Please publish it or send it to santoshjaiswal35@gmail.com
Left by Santosh jaiswal on Jun 09, 2014 11:40 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
if some have source code.
please send me, if you don't mind.
tanks.
Left by Brian on Jun 19, 2014 2:28 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
it seem interest project, can you send me to check and try!, thanks
Left by Alexander Osorio on Aug 24, 2014 7:55 PM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
Could you please send also to me the source code? Thanks!
My email is: qaiserfatmi@gmail.com
Left by Qaiser Fatmi on May 13, 2015 10:00 AM

# re: Poor Man's Schedule Component for Windows Forms
Requesting Gravatar...
pls send me the source code pls thanks
Left by mark on May 15, 2015 12:33 PM

Your comment:
 (will show your gravatar)


Copyright © Szymon Kobalczyk | Powered by: GeeksWithBlogs.net | Join free