473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to make loop month by month ?

Hi everybody !

i'm begining with Visual Basic Express Edition and i try
to make a loop month by month between two dates.

I have insuccessfully tried something like this :

From DateOfDateTimePicker1 to DateOfDateTimePicker2
Msgbox (Month & vbcrlf & Year)
Next

Thank you for your attention,

Estelle (from Paris)
Jan 28 '07 #1
3 5435
Estelle,

There are a lot of approaches for that. Let a service run all the time on
your computer.

However that has no sense than your computer should never be shut down.

You can set the date in your register and start your program up as a service
and let it look every 10 minutes to that register. And than using resources.

The most advised option is just to use the standard Windows Scheduler.

Cor

<fe***********@laposte.netschreef in bericht
news:Oy*************@TK2MSFTNGP02.phx.gbl...
Hi everybody !

i'm begining with Visual Basic Express Edition and i try
to make a loop month by month between two dates.

I have insuccessfully tried something like this :

From DateOfDateTimePicker1 to DateOfDateTimePicker2
Msgbox (Month & vbcrlf & Year)
Next

Thank you for your attention,

Estelle (from Paris)

Jan 28 '07 #2
If I understand your question correctly, you might try code such as:

'get months from dateTime1 to dateTime2
Dim lesser, greater As DateTime
If dateTime1 < dateTime2 Then
lesser = dateTime1
greater = dateTime2
Else
lesser = dateTime2
greater = dateTime1
End If

While lesser <= greater
Console.WriteLine(lesser.Month)
lesser = lesser.AddMonths(1)
End While

===============
Clay Burch
Syncfusion, Inc.

Jan 28 '07 #3
Hi Clay

it's wonderful ! you have exactly understood what I needed

Thank you very much !

Evelyne

"ClayB" <cl***@syncfusion.coma écrit dans le message de news:
11*********************@p10g2000cwp.googlegroups.c om...
If I understand your question correctly, you might try code such as:

'get months from dateTime1 to dateTime2
Dim lesser, greater As DateTime
If dateTime1 < dateTime2 Then
lesser = dateTime1
greater = dateTime2
Else
lesser = dateTime2
greater = dateTime1
End If

While lesser <= greater
Console.WriteLine(lesser.Month)
lesser = lesser.AddMonths(1)
End While

===============
Clay Burch
Syncfusion, Inc.

Jan 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim | last post by:
Im getting way too many rows retured..what its trying to do is insert a 0 for revenue for months 7 - 12 (aka July through December) for each of these cost centers for each payor type..Im getting a...
11
by: laurenq uantrell | last post by:
I want to take the contents from a table of appointments and insert the appointments for any given month into a temp table where all the appointments for each day are inserted into a single row...
4
by: jstaggs39 | last post by:
I have a form that requires a start date and an end date as input for the parameters then runs the form which open queries which are designed to populate certain tables. As it stands now, i can...
7
by: Novice Computer User | last post by:
Hi. Can somebody PLEASE help. I have spent hours on this.. but I am a total novice and can't seem to figure it out. Here is a .php script. Right now, the minimum amount of time (i.e. duration)...
12
by: upernikaw | last post by:
Hello, I am attempting to create a nested loop (in Access 2003/VB) that will print a report for a set of user defined months inputed on a form and that will print out for every Client. So the first...
2
by: boyleyc | last post by:
Hi all the following code works perfectly well. Basically it populates a series of check boxes on my form, depending on whether dlookup finds an associated record. The problem i have is that...
3
by: simpleeshelbee | last post by:
Hey guys, This is my second post and is URGENT!!!! My final assignment is due tonite for class and I have no idea how to write this program right! I am supposed to write a program that uses a...
1
by: zelmila19 | last post by:
Hi can anyone tell me how to do this problem: Write a program using a while loop that asks the user to enter their sales for each month until they enter -1 (sentinel value). After this, it should...
0
by: troy_lee | last post by:
Here's what I have so far... Private Sub Text4_AfterUpdate() Dim dtmWeek1BegDate As Long Dim dtmWeek1EndDate As Long Dim intWeekNumber As Integer ' Text4 is the beginning day of the month...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.