# VBForums UtilityBank > UtilityBank - Components >  Large Calendar Control

## jdc20181

*The Problem*

The Tiny, itty bitty, calendar control - that even if you resize IS NOT bigger, rather it shows MORE months!

*Credits, Inspirations, and differences.* 

The Original Project isn't mine, so I can't take complete credit other than the several hours I worked on this. 

The Difference is mine is shipped as a DLL rather than just a big long tutorial. (Big Long Optional Tutorial is also included in this article lol)

*Copyright, licenses, etc. etc.* 

Origin of code belongs to the person, in that post above. 

My Adaptation, since no license was displayed, I assume he holds copyright - and entitlement to attribution, but, the work I spent creating this, was me, myself, and I. 

You can use it for any purpose you wish. As long as you link to the rightful owner(s) of the code, and this project. 

The  DLL is Licensed under the MIT License, thus, it took me a few hours to complete. 

You can view that license here


* Installation* 

_CalV1_ is the Class/Control name, I have took the privlage of adding all the countless naming and labeling that needed to be done, for your enjoyment. 

There is several ways to install including lots of options. Please pay attention

*Standard Install* 

Download the _CalV1.DLL_ File - Once downloaded - Be sure to unzip the Zip Folder - Open VS 2012* or newer - 

Option 1) Save, and Reuse for All Projects (Saves to your toolbox)

To do this - in VS go to Tools > Choose Toolbox Items 

Next,  Choose Browse, Go to The Calendar Control Folder, and locate the DLL and select it. 

Hit OK. 

Option 2) Add it for this project only. 

Add New File > The Calendar Control Folder > CalV1.DLL

Rebuild your project and it *should* be in your toolbox. 


You are also welcome to download the Main Project and modify to your needs. You will need to know how to save it as a DLL etc. to do this. 


*ONCE INSTALLED - SPECIAL INSTRUCTIONS* 

"Root Name" is CalV1 - When you add it will be CalV11 etc etc etc. Call it accordingly. 

To make it work, you need to call it when the form loads. 



```
        Calv1.ReloadCal(Date.Today, Date.Today.Day)
```

* OverView* 


As you can see it is MUCH bigger than the standard calendar control - If you want even bigger you can do so by downloading the entire project and editing it yourself. 

If you don't wanna do all the dirty work you can also do this:



```
Calv1.Labelname.Autosize = False 
Calv1.Labelname.Height = X
Calv1.Labelname.Width = Y
```

This will ONLY resize it for that instance of the control. 





*Downloading!* 

Dll's Aren't allowed on this forum, so I created a Respo, and added the DLL there for download. 


If you are worried about viruses etc etc etc (nothing of which I want to partipate in creating, rather I want to end the days of viruses)

You can copy/Paste the code, and get the "Calv1-Project.zip" and use the control, Simply takes too much time and effort to manually build this yourself. 


Go to the latest Releases 

*Download DLL ONLY - Download "Calv1.zip"
*
*Download NO .EXE Project - Download "Calv1-Project.zip" 
*

* Build yourself* 

Follow instructions in the Code Origin Article. 

For "Grid of labels" it simples means put them in equal rows of 7 and 6 high with 1 more high to display the day of the week. 

You can also grab the orignal code, and follow the "Errors" to fix it yourself, copy/pasting code will give several errors. 

Takes about 40+ labels to create. 



* Built in VS '13, on Windows 8.1, for best results use VS '12 or newer - Not Tested on other versions of VS.

Oh I forgot one last thing, you can override manually the color of todays date, I forgot to change it from the default of Yellow, that will be changed next round. And maybe I will just Add some more Styling also. 

Suggestions, Bug Reports - etc are always welcome. 



The Full Code is just the pasted code from the Form1 File, I didn't use a control, so I didn't reference it as Calv1

this isn't a point and build you will have to add all the controls respectively. Full code (as per requested):

The code is in a class etc. this is without the "Initialize" on form load which is said above about that. 

This code is in both versions the entire project and dll. Use whichever you wish. 


```
 Public Sub ReloadCal(ByVal ldate As Date, ByVal Selected As Integer)
        On Error Resume Next
        Me.clearall()
        MonthName.Text = monthstr(ldate.Month)
        Dim fdate As DayOfWeek = GetFirstOfMonthDay(ldate)
        Dim idate As Integer = 1
        Dim row As Integer = 1
        Do
            getlabel(fdate, row).Text = idate
            getlabel(fdate, row).ForeColor = Label1.ForeColor
            If idate = Selected Then
                getlabel(fdate, row).ForeColor = Color.Yellow
            End If
            If fdate = DayOfWeek.Saturday Then
                row += 1
            End If
            fdate = tdate(fdate)
            idate += 1
            If idate = Date.DaysInMonth(ldate.Year, ldate.Month) + 1 Then
                Exit Do
            End If
        Loop
    End Sub

    Sub clearall()
        su1.Text = ""
        su2.Text = ""
        su3.Text = ""
        su4.Text = ""
        su5.Text = ""
        su6.Text = ""

        m1.Text = ""
        m2.Text = ""
        m3.Text = ""
        m4.Text = ""
        m5.Text = ""
        m6.Text = ""

        tu1.Text = ""
        tu2.Text = ""
        tu3.Text = ""
        tu4.Text = ""
        tu5.Text = ""
        tu6.Text = ""

        w1.Text = ""
        w2.Text = ""
        w3.Text = ""
        w4.Text = ""
        w5.Text = ""
        w6.Text = ""

        th1.Text = ""
        th2.Text = ""
        th3.Text = ""
        th4.Text = ""
        th5.Text = ""
        th6.Text = ""

        f1.Text = ""
        f2.Text = ""
        f3.Text = ""
        f4.Text = ""
        f5.Text = ""
        f6.Text = ""

        sa1.Text = ""
        sa2.Text = ""
        sa3.Text = ""
        sa4.Text = ""
        sa5.Text = ""
        sa6.Text = ""
    End Sub

    Function getlabel(ByVal day As DayOfWeek, ByVal row As Integer) As System.Windows.Forms.Label
        Select Case day
            Case DayOfWeek.Sunday
                Select Case row
                    Case 1
                        Return su1
                    Case 2
                        Return su2
                    Case 3
                        Return su3
                    Case 4
                        Return su4
                    Case 5
                        Return su5
                    Case 6
                        Return su6
                End Select
            Case DayOfWeek.Monday
                Select Case row
                    Case 1
                        Return m1
                    Case 2
                        Return m2
                    Case 3
                        Return m3
                    Case 4
                        Return m4
                    Case 5
                        Return m5
                    Case 6
                        Return m6
                End Select
            Case DayOfWeek.Tuesday
                Select Case row
                    Case 1
                        Return tu1
                    Case 2
                        Return tu2
                    Case 3
                        Return tu3
                    Case 4
                        Return tu4
                    Case 5
                        Return tu5
                    Case 6
                        Return tu6
                End Select
            Case DayOfWeek.Wednesday
                Select Case row
                    Case 1
                        Return w1
                    Case 2
                        Return w2
                    Case 3
                        Return w3
                    Case 4
                        Return w4
                    Case 5
                        Return w5
                    Case 6
                        Return w6
                End Select
            Case DayOfWeek.Thursday
                Select Case row
                    Case 1
                        Return th1
                    Case 2
                        Return th2
                    Case 3
                        Return th3
                    Case 4
                        Return th4
                    Case 5
                        Return th5
                    Case 6
                        Return th6
                End Select
            Case DayOfWeek.Friday
                Select Case row
                    Case 1
                        Return f1
                    Case 2
                        Return f2
                    Case 3
                        Return f3
                    Case 4
                        Return f4
                    Case 5
                        Return f5
                    Case 6
                        Return f6
                End Select
            Case DayOfWeek.Saturday
                Select Case row
                    Case 1
                        Return sa1
                    Case 2
                        Return sa2
                    Case 3
                        Return sa3
                    Case 4
                        Return sa4
                    Case 5
                        Return sa5
                    Case 6
                        Return sa6
                End Select
        End Select
    End Function

    Private Function GetFirstOfMonthDay(ByVal ThisDay As Date) As DayOfWeek
        Dim tday As DayOfWeek = ThisDay.DayOfWeek
        Dim tint As Integer = ThisDay.Day
        If tint = 1 Then
            Return tday
            Exit Function
        End If
        Do
            tint -= 1
            tday = ydate(tday)
            If tint = 1 Then Exit Do
        Loop
        Return tday
    End Function

    Private Function ydate(ByVal tday As DayOfWeek) As DayOfWeek
        Dim rday As DayOfWeek
        Select Case tday
            Case DayOfWeek.Sunday
                rday = DayOfWeek.Saturday
            Case DayOfWeek.Monday
                rday = DayOfWeek.Sunday
            Case DayOfWeek.Tuesday
                rday = DayOfWeek.Monday
            Case DayOfWeek.Wednesday
                rday = DayOfWeek.Tuesday
            Case DayOfWeek.Thursday
                rday = DayOfWeek.Wednesday
            Case DayOfWeek.Friday
                rday = DayOfWeek.Thursday
            Case DayOfWeek.Saturday
                rday = DayOfWeek.Friday
        End Select
        Return rday
    End Function

    Private Function tdate(ByVal tday As DayOfWeek) As DayOfWeek
        Dim rday As DayOfWeek
        Select Case tday
            Case DayOfWeek.Sunday
                rday = DayOfWeek.Monday
            Case DayOfWeek.Monday
                rday = DayOfWeek.Tuesday
            Case DayOfWeek.Tuesday
                rday = DayOfWeek.Wednesday
            Case DayOfWeek.Wednesday
                rday = DayOfWeek.Thursday
            Case DayOfWeek.Thursday
                rday = DayOfWeek.Friday
            Case DayOfWeek.Friday
                rday = DayOfWeek.Saturday
            Case DayOfWeek.Saturday
                rday = DayOfWeek.Sunday
        End Select
        Return rday
    End Function

    Public Function monthstr(ByVal month As Integer) As String
        Select Case month
            Case 1
                Return "January"
            Case 2
                Return "Febuary"
            Case 3
                Return "March"
            Case 4
                Return "April"
            Case 5
                Return "May"
            Case 6
                Return "June"
            Case 7
                Return "July"
            Case 8
                Return "August"
            Case 9
                Return "September"
            Case 10
                Return "October"
            Case 11
                Return "November"
            Case 12
                Return "December"
        End Select
    End Function
```

----------


## jdc20181

This was requested - to upload a Zip of the Project WITHOUT DLL's or .EXE'S

Understand, that in order to create a DLL project you need to add a new project to this one, copy and paste the control into it, delete the FORM1.vb, go to project settings and rename it to "Class" 

This is the starter Frame for the entire project  - shouldn't take but a few min to setup, Github copies, and the DLL easy peasy release is above.

To make this project run right, you will need to rebuild possibly a few times. 

Attached is the latest version (V1)



Calv1-Project.zip

----------

