wrxdriven Posted November 4, 2003 Posted November 4, 2003 can anyone help me with this date problem? I have to write an amortization schedule to a listview box. There are some headers on the top that have to do with the systems date ie now. I need to loop some sort of structure that will count down months with their abbreviation which i can't seem to figure out. Also i need to count down years in accordance with the date. As the months drop to dec then the next jan it will be a year higher. when i run the program it needs to load the values that the computers clock has set. so i need the months to read line by line starting with lets just say it is todays month which is nov and then the year 2003, then the next month with 2003, and then as jan comes the year is 2004 and so on. What do i have to do in my loop? THanks Quote
mocella Posted November 4, 2003 Posted November 4, 2003 Try something like this (just adjust the number of times you loop to what you need). It's crude, but it should suit your purposes: Dim currMonth As Integer = DateTime.Now.Month Dim currYear As Integer = DateTime.Now.Year Dim myDates(6) As String Dim i As Integer For i = 0 To 6 myDates(i) = currMonth & " " & currYear If currMonth = 12 Then currYear += 1 currMonth = 1 Else currMonth += 1 End If Next Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.