View Single Post
  #2 (permalink)  
Old June 29th, 2010, 05:44 AM
samjudson's Avatar
samjudson samjudson is offline
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

This is a .Net forum, yet you appear to be using the old VB style methods. These are in the compatibility layer, but things are usually much easier if you use the newer 'pure' .Net classes.

The following will give you the last day of the current month stored in newdt variable:

Code:
Newdt = new DateTime(Newdt.Year, Newdt.Month, 1).AddMonths(1).AddDays(-1)
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?