How to show DateTime.Now.ToString(Format(“yyyy”)) incrimental in for loop

If you want a loop to generate a series of years starting at the current year then you should do something like this:

For i = 0 To 10
    Dim year = Date.Now.Year + i

    '...
Next

Running that code now would give you a series of Integer values from 2014 to 2024 inclusive, to do with whatever you like.

Leave a Comment