Home > DeveloperSection > Articles > MonthCalendar Control in VB.Net

MonthCalendar Control in VB.Net

Posted by  Pushpendra Singh
on    December-12-2010 16:05 PM

VB.Net VB.Net 
Ratings:
0 Comment(s)
 8984  View(s)
Rate this:

MonthCalendar Control in VB.Net

The MonthCalendar control allows you to select date.

How to use MonthCalendar Control

Drag and drop MonthCalendar Control from toolbox on the window Form.

MonthCalendar Control in VB.Net

Code:

Public Class Form11

    Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged

        'selected date will display in Label

        Label2.Text = "Selected date is  " + MonthCalendar1.SelectionRange.Start

    End Sub

End Class

Run the project

MonthCalendar Control in VB.Net

When you select date then DateChanged event will fire and selected date will show on the Label.

MonthCalendar Control in VB.Net

Properties of MonthCalendar

FirstDayOfWeek: Default value is Sunday. It means week starts with Sunday as the first day and Saturday as last. You can set the first day of the week depending upon your choice by selecting from the predefined list with this property.

ShowToday: Default value is set to true which displays the current date at the bottom of the Calendar. When set it to False will hide current date.

Private Sub Form11_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Hide current date

        MonthCalendar1.ShowToday = False

 End Sub

MonthCalendar Control in VB.Net

ShowTodayCircle: Default value is set to true which displays a circle on the current date. Setting it to False will make the circle disappear.

ShowWeekNumber: Default is False. Setting it to True will display the week number of the current week in the 52 week year. That will be displayed towards the left side of the control.

 
















Recent Activities

jayprakash sharma Created New Discussion what is short circuit operator in java   2 hours ago

Sumit Kesarwani added new Question What is the Vector class in java?   2 days ago

Anchal Kesharwani added new Blog JSON Syntax   9 days ago

Anchal Kesharwani added new Article How to Send Mail in Node.JS   9 days ago

Top Contributors

Don't want to miss updates? Please click the below button!