calculate months between 2 dates in visual basic .net

I would like an application to fill a combobox and populate it with month, year from September of 2010.  So the combo box would look like
September, 2010
October, 2010
November, 2010
Up to the current month of when they launched the application.  How can I set that up?
chadmanvbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
Hi...Here is a sample...(sure there might be also another way)

 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim Stardate As DateTime = New DateTime(2010, 9, 1)
        Dim EndDate As DateTime = New DateTime(Year(Today), Month(Today), 1)
        Dim M As Integer = Math.Abs((Stardate.Year - EndDate.Year))
        Dim months As Integer = CInt(((M * 12) + Math.Abs((Stardate.Month - EndDate.Month))))

        Dim i As Integer
        For i = 0 To months 

            Me.ComboBox1.Items.Add(MonthName(Month(Stardate.AddMonths(i))) & "," & Year(Stardate.AddMonths(i)))

        Next

    End Sub

Open in new window



Hope it helps ..

Yiannis
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chadmanvbAuthor Commented:
Perfect!  Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.