How to Create a Calendar in VB

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.

VB (Visual Basic) includes a helpful control that will create a calendar in a few steps. You can use this for display without having to write any code at all. With some additional code, the calendar can be manipulated to do many more things such as show multiple months at a time, allow the user to select specific dates or a range of dates for some further actions, highlight certain dates such as holidays in bold, or drag-and-drop dates to other projects.


Step 1

Open Visual Basic and create a new Standard Exe project by selecting this from the "File," "New Project" menu. After the window displaying "Project1 – Form1(Form)" with a smaller "Form1" shows on the screen, save the project under a memorable name such as "MyCalendar."


Video of the Day

Step 2

Add the MonthView control to the list of general controls in the ToolBox panel on the left by clicking on "Project" in the top-level menu. Click on "Components" in the drop down list. Scroll down the list under the "Control" tab until you find the Microsoft section. Put a check mark in the box next to "Microsoft Windows Common Controls 2-6-0" by clicking on the box. Click "Apply" and then "OK."


Step 3

Double-click on the "MonthView" control, which now shows in the ToolBox, probably as one of the last items. This places a calendar on Form1 showing the current month.

Step 4

Review the properties options for the calendar that are listed in the right hand panel. There you can control many attributes of the calendar, including calendar color, the Font and Font colors of the title, days and dates, colors of the grids what day of the week should start the calendar and others. View additional custom properties by right-clicking on the calendar itself. Working in the custom area allows more control, but the main Property window allows you see changes instantly without going back and forth from one view to the other.



Save the project again when you are satisfied with the appearance. Press "F5" to run the project. The calendar will display and you can use the typical computer calendar choices to advance or go back in months and years.



references & resources

Report an Issue

screenshot of the current page

Screenshot loading...