3 Aug '15

Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

0 Shares

Display total Days in Current Month

Display total Days in Current Month in VB.NET

This is the Coding to Display total Days in Current Month. This is the simple code written in VB.NET to count total days in current month. This coding is usefull on some cases while developing some projects. So Let’s begin with this sample program.

Example Code:

In the button click event 3 lines of code created. In the first line it stores current date and time in CurrentDateTime variable. Date.DaysinMonth counts number of days in the given month and year.

  • NOW is the property of VB.NET which access current date and time.
  • Use the date data type to store date value.
  • CurrentDateTime.Year takes current year from CurrentDateTime variable.
  • CurrentDateTime.Month takes the current month from CurrentDateTime variable.
  • The integer variable DaysInMonth stores the value of total number of days.
  • In the messagebox it displays the result in the modal box.
  • The output is current system date and time.

Screenshot: 

Open Visual Studio. In the File menu Click on New-> Project. In the project select Visual basic -> Windows Forms application. Enter the project name, select the location to store. It will display one form. In this program just we created one button in the form. The message box will appear after clicking the button.

Form Name: frmtotaldays

Button Name: btncountdays

Display total Days in Current Month


Example Source Code:

This source code developed in VB.NET 2012 and it supports almost all versions. Here is the example source code that we did while preparing video tutorial.

download

Video Tutorial:

This video tutorial clearly explains how to write this program.

Thanks for Reading this article. If any doubts kindly post your queries in the comment box.

About Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

Related Posts

Leave a Reply