Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...