Set two DateTimePicker date range to last month - Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This code is used when you need to set two DateTimePicker date value to the range of the beginning of last month and the end of last month. Example: you make a software to track a store sales and you want to know how much in sales you made last month.

In this program, you will learn how to change the value of the two DateTimePicker control: the first one to the beginning of last month and the second one to the end of last month:

DateTimePicker1.Value = Today.Date.AddMonths(-1)
DateTimePicker1.Value = DateTimePicker1.Value.Date.AddDays(-Today.Day + 1)
DateTimePicker2.Value = Today.Date.AddDays(-Today.Day) last month

Share This

Home | About | Contact | Privacy Policy

Copyright 2017 - All Rights Reserved.