Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning dates in order to labels

Status
Not open for further replies.

funkyyuzzam

Programmer
Aug 12, 2002
10
GB
Hi

I am tryingto develop a diary type application. Basically i need list each day of the current week on seperate labels. Next to each label will be a text box where a user will enter an event which will be stored as avariable to use later.

So what I need to know is how to assign each label with the current date and the next day etc..etc. Obviously i need to take into account leap years so I cant manually assign the caption for each date, not to mention doing this for every day of the year.

I will do a different form for each month probably.

Can u help

Thanks in advance

Funky
 

You really only need one form for each month. What you will need to do is figure out what day the first day of the current displayed month is and dynamically update the user interface.

Example:

This month began on a thursday so you know that day 1 thursday day 2 is friday etc. etc.

Then you will need to find the last day of the month (there is another thread out there and I know someone will point you to it).

So know you know what day the month starts on and how many days are in it. You can then set up your labels in the correct columns (Sun-Sat) or whatever layout you want to use. By running through a loop.

 

After reading what I just wrote let me state the first sentence differently.

You really only need one form to display each month no matter what month it is. (You only need one form!)

That will teach me for not proof reading!
 
If you want to increment the date by one you can just increment the date and let windows worry about the month and leap years etc.

label1.caption=date
label2.caption=date+1
label3.caption=date+2
etc.

You can also set the date of the first label to the first day of the month and increment from there.

dim datMonth as date
datmonth='9/1/2002'
label1.caption=datmonth
label2.caption=datmonth+1
label3.caption=datmonth+2
etc.

Hope this helps.

Thanks and Good Luck!

zemp
 
Thanks Zemp

I had thought of this actually so I'm glad you think it's a viable technique.

funky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top