Following function  will  get a list of months  with days remaining in those months  when start date and end dates are provided

Shared Function GetMonthsList(StartDate As Date, EndDate As Date) As ArrayList


Dim dt As Date = StartDate
Dim edt As Date = EndDate

Dim ar As New ArrayList
Dim str As New StringBuilder

While dt < edt

str.Append(dt.Date.ToString("MMMM yyyy"))
Dim dt2 As Date = dt.AddMonths(1)

If dt2 > edt Then
Dim minusdays As Integer = DateDiff(DateInterval.Day, dt, edt)
str.Append(minusdays + 1)
Exit While
End If

Dim remainingdays As Integer = System.DateTime.DaysInMonth(dt.Year, dt.Month) - dt.Day
str.Append(remainingdays + 1)

dt = dt.AddDays(remainingdays + 1)
End While

Return ar

Catch ex As Exception
Throw ex
End Try
End Function

Use can use this functions as


this will output

January 2012,28
February 2012,29
March 2012,31
April 2012,30