Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use MonthCalendar Control in VB.NET

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "how to use MonthCalendar controls in VB.NET", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use MonthCalendar controls in VB.NET" this article.

The VB.NET MonthCalendar control allows you to select a date and a set of dates. This control allows the user to easily select a date. It is similar to a DataTimePicker control that lets you select a specific date, but the MonthCalendar control can also help you choose a time.

Use the VB.NET MonthCalendar control

The following example shows how to use the MonthCalendar control.

Locate the MonthCalendar control in the Toolbox under the common control (Common Controls) and add it to the window form (Window Form), and set the following properties:

Name:mcDateSelection TodayDate: empty MaxSelectionCount:1 Selection Range Start: empty Selection Range End: null add the following code to the Form Load event: mcDateSelection.TodayDate = Now

Then create the events in list A. In this example, I set the MaxSelectionCount property to 1, which means that you can only select one of the VB.NET MonthCalendar controls, not a set of dates. Select a date in the MonthView control, and the screen looks like.

List A

Private Sub mcDateSelection_

DateSelected (ByVal sender As

Object, ByVal e As System.

Windows.Forms.DateRangeEventArgs)

Handles mcDateSelection.DateSelected

MessageBox.Show ("Calendar"

Today's Date: "& mcDateSelection.

TodayDate & vbCrLf & _

"Calendar Selected Start Date:

"& mcDateSelection.Selection

Start () & vbCrLf & _

"Calendar Selected End Date:

"& mcDateSelection.SelectionEnd ())

End Sub

Since you can only choose a specific date in a month, rather than a set of dates, Selected Start Date and Selected End Date have the same values.

Now, set the MaxSelectionCount property to 7 and rerun the code. This time, you can choose a set of dates (in this case, a maximum of 7 days.

Other uses of VB.NET MonthCalendar controls

You can take advantage of many other properties and methods of the MonthCalendar control to meet your needs.

The above is all the content of the article "how to use MonthCalendar controls in VB.NET". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report