Hello ,

I would like to achieve something which I think is possible using the method Date.daysinmonth.
The thing is I am not sure what the syntax would be. Totally confused.
I have a ddbox that holds date and changes dynamically.That date would always be the last date of a month.
So what I want is in a text box using that method (if I am not wrong) to get the next month last day as date in format YYYY-MM-DD.
In other words:
If In the dropdown I have say 2009-01-31 ,in the etxt box I would like to have 2009-02-28 - the last day of next month of the same year.
Was looking around but got nothing as all examples were on a set date , date that is known. And here the date will always change.
Sorry I haven`t got any code lines , cause I simply don`t know how to start.
Please help

Thanks in advance

You're right about that you have to know the number of the days in a month.

This snippet will add one month to a date and "modifies" date to be the last day of the month. In December it goes to the January of the next year. I used DateTime-picker control, just replace DateTimePicker1.Value with your dropdown's Text-property. It should work ok if your dropdown contains valid dates.

Dim TempDate As Date

' 1) Add one month to get next month
TempDate = CDate(DateTimePicker1.Value).AddMonths(1)
' 2) Is the last day of the month, if not add "missing" days
TextBox1.Text = CDate(TempDate.AddDays( _
  Date.DaysInMonth(TempDate.Year, TempDate.Month) - _