You are here:

Visual Basic/Auto Increment of number using system date

Advertisement


Question
May I ask on how what code to use on autoincrementing of number using system date. For example i = 40 'number for today
I need a code that will increment i to 41 on the following day and 42 on the next and so on until it reach to 99 and it will reset to 40 again after 99's day has elapsed. My friends told me to use the for loop in doing so but I don't seem to get it caus when I do the loop it will just increment to 41 and the following it is still 41. Kindly hep me please.

Answer
Dear Karl,

Yes, this problem could be solved using loops, so the problem is within your code, and you didn't supply one. So, please, send me your code so I could troubleshoot it.

One more thing needs to be clarified: according to your assignment, this program is starting once and running nonstop, OR you are suppose to start it every day? And what should you do if you are starting this program several times during the day?

Regards,

Vitaly  

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


VITALY

Expertise

Area of expertise is Visual Basic .NET (VS 2008 and Framework 3.5) design and development for Windows applications. You can ask me any Visual Basic questions and some questions about .NET Framework. You can also ask me how to use Component One controls in Visual Basic. Do not ask me questions about Web design and development in Visual Basic.

Experience

I'm working as VB programmer from 1997, so I have a lot of experience with Visual Basic .NET as well as Visual Basic 6. Area of expertise is Visual Basic .NET (VS 2008 and Framework 3.5) design and development for Windows applications; Component One controls for Visual Basic; User controls; Moving VB6 applications to .NET.

Education/Credentials
B.S. in Computer Science

©2016 About.com. All rights reserved.