How to write code for date checking in vb6

I have been using this program for some time now to track tasks eg: Reminders(birtdays, dr. appointments etc)
the task date is the file name The file names with "Yr" at the start repeats every year.

I have a small calendar control got somewhere a few yrs ago, trying to modify it to create a preview of upcoming
tasks using an array of richtexboxes based on the dates in an array eg: when the month or year changes find the
date a task is due by turning the backcolor to rtfDay(?).BackColor = RGB(255, 255, 204) 'light yellow
Later i will open the file to the rtfDay, based on the index of of the selected rtf
i have the correct dates format in an array mMyArray to compare against the selected month/yearform
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
So if I were to select 09-25-2015.rtf do you just want the rtdDate that reflects that date selected?
isnoend2001Author Commented:
No when the month/years are changed highlight any dates that saved
Martin LissOlder than dirtCommented:
I'm sorry but I don't know what that means. Can you give me an example?

BTW if your app is going to create directories (if they don't already exist) I think you should ask the user if he wants to continue and quit if the answer is no.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

isnoend2001Author Commented:
Clicking the >>  for months and years will reveal if any tasks are due in that month based on the saved dates in other words
seolecting month 8 2016 would highlight
in the rtbDay
Martin LissOlder than dirtCommented:
So are you saying that if there were, say, 4 rtf files for a given month that all four dates would be highlighted?
isnoend2001Author Commented:
BTW if your app is going to create directories (if they don't already exist) I think you should ask the user if he wants to continue and quit if the answer is no.

Good thought, but this only for me and maybe my sister
Martin LissOlder than dirtCommented:
OK but what about my question in post ID: 40980875?
isnoend2001Author Commented:
So are you saying that if there were, say, 4 rtf files for a given month that all four dates would be highlighted?

Martin LissOlder than dirtCommented:
OK try this. I highlighted the task days in aqua marine rather than light yellow because I didn't know what you wanted to do if a task day matched today's date (which currently is light yellow). All the changes I made are marked with 'New

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Thanks Marty
Sorry took so long had to find out how to unzip files in win 7. cannot  get used to win 7  what a pain. everything works better, but finding out how is my problem. i installed image composer from my frontpage 98 cd  to create the  forms image for this page. i upgraded free to to win 10, but found it more difficult so i put back win 7
Martin LissOlder than dirtCommented:
You're welcome.

I don't ever expect to upgrade my XP. I may have mentioned before that I run XP as an virtual machine on my iMac.
isnoend2001Author Commented:
Hi Marty
I incorrectly added 2 date file names twice
With cboTaskDate
 .AddItem "01-03-2016.rtf"
 .AddItem "02-20-2016.rtf"
 .AddItem "03-10-2016.rtf"
 .AddItem "07-26-2016.rtf"
 .AddItem "09-25-2015.rtf"
 .AddItem "1-3-2016.rtf"
 .AddItem "11-18-2015.rtf"
 .AddItem "11-29-2015.rtf"
 .AddItem "12-25-2015.rtf"
 .AddItem "3-10-2016.rtf"
 .AddItem "9-17-2015.rtf"
 .AddItem "9-25-2015.rtf"
 .AddItem "Yr01-10-2016.rtf"
 .AddItem "Yr06-23-2016.rtf"
' .AddItem "Yr08-03-2016.rtf" 'remove here
 .AddItem "Yr09-09-2016.rtf"
 .AddItem "Yr7-4-2016.rtf"
 .AddItem "Yr8-22-2016.rtf"
 .AddItem "Yr8-3-2016.rtf" 'see above added twice
 End With
But this got me to thinking what if 2 reminders were on the same day. how would i handle it ?
To handle reminders to repeat every year (birthdays, etc)  i added the "yr" when the reminder is deleted a file for next year is created with the same contents.
I noticed a small problem with your code hers how i did it:
clicked to increase the month to November 2015
11-18 and 11-29 are highlighted, this is correct
then increase the year to 2016
11-18 and 11-29 are again highlighted , this is not correct.

The reminder program works like this:
i put an exey in the start folder for windows it scans the folder task dates and if a task is due in the next 6 days it displays a msgbox "Task due in 6 days" when clicked it opens the rtf
next day "Task due in 5 days"  etc.
if no task-reminder is due it unloads from memory.
This works fine for me, because i turn off my pc every night, but my sister does not.
I will post another question on how to handle this.
isnoend2001Author Commented:
forgot, gotta take my sister to the doc today in another town, all day thing
my reminder program tod me so
Martin LissOlder than dirtCommented:
Sorry about that. I thought about the year when I started, but then forgot about it. To correct the problem change line 16 as shown
Private Sub HighlighTasks()

Dim lngIndex As Long
Dim strParts() As String

' Clear existing aqua marine highlights

For lngIndex = 0 To rtfDay.Count - 1
    If rtfDay(lngIndex).BackColor = RGB(127, 255, 212) Then
        rtfDay(lngIndex).BackColor = vbWhite
    End If
For lngIndex = 0 To UBound(mMyArray)
    strParts = Split(mMyArray(lngIndex), "-")
    ' Check the month and year
    If strParts(0) = Split(calDate, "/")(0) And strParts(2) = Split(calDate, "/")(2) Then
        rtfDay(Day(mMyArray(lngIndex)) + firstday).BackColor = RGB(127, 255, 212)  'aqua marine
    End If

End Sub

Open in new window

For your multiple tasks in a day problem:
Currently as you know, the rtfDay controls only show the day number. Do you have any other plans for them? BTW you should probably add code like rtfDay(5).Locked = True in a loop in the Load event because otherwise someone could write in the control.

One thing you could do would be to add a new label at the bottom that shows the number of tasks due today. Another more elegant approach would be to add code in the rtfDay_Click event that would temporarily expand the width of the form to the right and show the details of the days tasks, assuming that those details were in the rtf files. I've attached a little demo of what I'm talking about..
isnoend2001Author Commented:
This expand seems like a good idea, but do you mean then have 2 rtf.s in the expanded area?
The other question that i closed before i got your answer, if there was a way i could know you are posting i would wait.
i am thinking that a way to mark a file is to scan the file names and then add something like this
to the file name: Yr08-03-2016(2).rtf if i know you are available i will post this as a question
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.