Szymon Kobalczyk's Blog

A Developer's Notebook

  Home  |   Contact  |   Syndication    |   Login
  106 Posts | 6 Stories | 576 Comments | 365 Trackbacks

News

View Szymon Kobalczyk's profile on LinkedIn

Twitter












Tag Cloud


Article Categories

Archives

Post Categories

Blogs I Read

Tools I Use

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

Feedback

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

# re: Poor Man's Schedule Component for Windows Forms 1/11/2006 6:10 AM Andrzej
I'll also be glad to see the code

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

# re: Poor Man's Schedule Component for Windows Forms 1/20/2006 4:54 PM Renee
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 (:


# re: Poor Man's Schedule Component for Windows Forms 1/25/2006 6:27 PM DeveloperDan
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!



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

# re: Poor Man's Schedule Component for Windows Forms 2/19/2006 3:09 AM RedEye
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!!

# re: Poor Man's Schedule Component for Windows Forms 3/9/2006 12:35 AM Jonny
Great job!
Could you please send also to me the source code? Thanks!
My email is: xue7xiao@hotmail.com


# re: Poor Man's Schedule Component for Windows Forms 3/9/2006 5:50 PM Szymon
You can download it here:
http://projectdistributor.net/Releases/Release.aspx?releaseId=307

# re: Poor Man's Schedule Component for Windows Forms 4/8/2006 12:13 AM RedEye
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

# re: Poor Man's Schedule Component for Windows Forms 7/14/2006 4:55 AM Orland Frias (ph)
this is may Email Address
orland_frias@yahoo.com

Thnkx

# re: Poor Man's Schedule Component for Windows Forms 8/24/2006 9:32 PM Chris
Hi,

This looks like a great component, where can I download it?

# re: Poor Man's Schedule Component for Windows Forms 10/20/2006 3:01 PM Jocke
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

# re: Poor Man's Schedule Component for Windows Forms 11/6/2006 6:19 PM nick
Could someone please explain how to use this control in a VB2005 project? Thanks...


# re: Poor Man's Schedule Component for Windows Forms 12/23/2006 5:01 PM Jassim Rahma
I would love to get this schedule.. my email is jrahma@yahoo.com

...thaks

# re: Poor Man's Schedule Component for Windows Forms 2/15/2007 6:32 PM Hydie
I would like to get the schedule.
Email: hydie627@yahoo.com.hk

Thanks!

# re: Poor Man's Schedule Component for Windows Forms 2/15/2007 8:54 PM Szymon
You can download the code here: http://projectdistributor.net/Releases/Release.aspx?releaseId=307

# re: Poor Man's Schedule Component for Windows Forms 2/20/2007 7:22 PM Adam Wilson
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.

# re: Poor Man's Schedule Component for Windows Forms 2/20/2007 10:50 PM Adam Wilson
Answered my own question

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=219872&SiteID=1

# re: Poor Man's Schedule Component for Windows Forms 3/24/2007 8:13 PM Jad
Is there a code for VB 6

# re: Poor Man's Schedule Component for Windows Forms 7/9/2007 12:40 PM hari
Its really Quiet interesting

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

# re: Poor Man's Schedule Component for Windows Forms 9/19/2007 2:01 PM Shweta
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

# re: Poor Man's Schedule Component for Windows Forms 12/21/2007 3:31 AM E.Neu
Is there another link to the code? The ProjectDistributor site is down.

Thanks

# re: Poor Man's Schedule Component for Windows Forms 12/31/2007 11:39 AM Szymon
I've moved the file to SkyDrive - look for the new linka above.

# re: Poor Man's Schedule Component for Windows Forms 1/5/2008 10:00 PM JJ
Still not working correctly. Zipped file is corrupt.

# re: Poor Man's Schedule Component for Windows Forms 1/9/2008 5:10 AM Himanshu
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

# re: Poor Man's Schedule Component for Windows Forms 3/11/2008 12:20 PM Jats
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.

# re: Poor Man's Schedule Component for Windows Forms 3/19/2008 9:05 AM Jon
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

# re: Poor Man's Schedule Component for Windows Forms 3/31/2008 10:19 AM rex
Can you let me know how do change to day /week view??

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

# re: Poor Man's Schedule Component for Windows Forms 9/16/2008 4:28 PM Jesus Campos
Nice job!

How I can use only one weeek against 6?


# re: Poor Man's Schedule Component for Windows Forms 9/22/2008 7:26 AM Sameer C Thiruthikad
Nice work!

# re: Poor Man's Schedule Component for Windows Forms 1/5/2009 3:21 AM Marion
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?

# re: Poor Man's Schedule Component for Windows Forms 2/8/2009 10:00 PM m900349
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.

# re: Poor Man's Schedule Component for Windows Forms 2/9/2009 12:28 PM m900349
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! :)

# re: Poor Man's Schedule Component for Windows Forms 3/17/2009 7:21 PM tg
How can I hook this up to my dataset, and also can I add multi day events?

# Good Work 4/21/2009 3:31 PM Timm
Very very good work, this calendar helps me a lot !!!!!!!

Thanks !

# re: Poor Man's Schedule Component for Windows Forms 5/31/2009 5:16 PM Marcin
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?

# re: Poor Man's Schedule Component for Windows Forms 6/1/2009 8:54 AM ab

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

# re: Poor Man's Schedule Component for Windows Forms 7/16/2009 1:33 AM Pablo
This is great control!!!

Well done dude :-D!!!

# re: Poor Man's Schedule Component for Windows Forms 4/11/2010 9:22 PM perde modelleri
I've moved the file to SkyDrive - look for the new linka above.


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

# re: Poor Man's Schedule Component for Windows Forms 6/17/2010 4:59 PM Snoopy33
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.

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

# re: Poor Man's Schedule Component for Windows Forms 7/14/2010 10:26 AM San Kochi
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


# re: Poor Man's Schedule Component for Windows Forms 8/4/2010 1:37 AM Rajkumar
I want oulook scheduler calender control in my windows form vb.net code plz send to above specfied mail

# re: Poor Man's Schedule Component for Windows Forms 9/26/2010 11:48 PM palani
HI, Any component like with time and minutes scheduling

# re: Poor Man's Schedule Component for Windows Forms 7/5/2011 3:09 PM joshua
This is really useful thankyou.

# re: Poor Man's Schedule Component for Windows Forms 7/21/2011 8:34 AM dell destek
Very Good document.Thank you for sharing us.

# Thx! 7/21/2011 10:02 AM lahmacun firini
Sharing is very beautiful and high quality

# re: Poor Man's Schedule Component for Windows Forms 7/21/2011 1:42 PM dell servis
sharing is very beatiful thanks

# re: Poor Man's Schedule Component for Windows Forms 7/21/2011 4:56 PM fuar standı
sharing is very beautiful and high quality

# re: Poor Man's Schedule Component for Windows Forms 7/22/2011 8:09 AM simit fırını
sharing high-quality and beautiful.

thx :) ..
nice site

# re: Poor Man's Schedule Component for Windows Forms 7/25/2011 9:38 AM rögar
sharing is very succesfull and high quality

# re: Poor Man's Schedule Component for Windows Forms 7/26/2011 10:43 PM Mike
Great presentation but how do you add the notes to the days?

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

# re: Poor Man's Schedule Component for Windows Forms 4/3/2012 9:40 AM Christian S
Great stuff, good quality and clear code!

# re: Poor Man's Schedule Component for Windows Forms 6/9/2014 11:40 AM Santosh jaiswal
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

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

Post A Comment
Title:
Name:
Email:
Comment:
Verification: