I am using VB 6 for my Project. There is requirement that Managers want to see blocking dates of an employee for a project.

Eg: If an employee blocked for a project till Dec 2010 then the dates in a calender till Dec 2010 will be showing in a specific colour or atleast the date font should be bold or anything that will show that the employee is blocked.

I am planning to use calender object in the form however i dont know how to show the date font bold or date in different colour till a specific date range

Can you please help me?

Thank you so much AndreRet. Its really wonderful. It covers 80% of my requirement. Can you please advise whether my below logic is correct to fulfill the remaining 20%.

The actual requirement is :
If a The Employee assinged for a project there would a entry in the database table with Allocation date (Project entry date) and Release date (Released from project date). So if enter his employee id then dates between his Allocation and release date should be coloured for that employee. Hence we came to know that how long we need wait for that resource.

Logic proposed:
Now the only change in your code is, I need to disable only flexigrid (so that no once will change the dates in it) and will give the code for colouring in a loop between start date and end date.

Would that make sense?

Now the only change in your code is, I need to disable only flexigrid (so that no once will change the dates in it) and will give the code for colouring in a loop between start date and end date.

These are the easy parts.

What I suggest is to set up your database table with the fields, call the data once a form loads and put them into a loop, i.e. record 1 will check for an employee id, fill the grid with his dates and add colour to them. Then lock the grid and then show the grid. I hope this makes sense from what I could gather from your question.:)

Agreed but the only problem is, if the resource blocked for more than a month in a project eg: 15th Sep 2010 to 28th Oct 2010 then i need to colour the dates from 15th Sep 2010 to 30th Sep 2010 in the current screen and 1st Nov to 28th Nov in the next screen (when the user change the month).

In this case do you suggest to load Sep and Nov month alone in the list box and its respective dates i.e 15th Sep 2010 to 28th Oct 2010 ?

Edited 6 Years Ago by divakar.it: n/a

Really sorry. I am bit confused. The flexigird values are just a number and not the dates. If i need to convert the numbers into dates then i need concatinate Date + Selected Month from Month list box + Selected year from yr list box. Even i do so how can i colour the date by using range as the flexi grid is only holding numbers. how it will recognize the dates if i pass date parameter?

Edited 6 Years Ago by divakar.it: n/a

No, keep it small. This is a very rough outline, you will still need to change the code to suit your needs -

Dim StartDataDate As Date, EndDataDate As Date, AllocationDays As Integer, x As Integer

StartDataDate = ' load the date to check for values starting from database
EndDataDate = ' Same here, get the end dates

AllocationDays = EndDataDate - StartDataDate

'Now add a loop to get each day
'Get the start date on the grid from data.
For x = 0 To AllocationDays
   'Add code here to colour the specific day in the calender
next x

This should color the respective days when called, only show the grid afterwards.:)

how it will recognize the dates if i pass date parameter?

Add a value to each number, say the 1st of December on the grid = 1 etc...

I would write an outside function as was the case with most of the other functions in the app. Before the loop, call the conversion and then add the loop so that each number in the loop is associated with a number on the grid. This will eliminate errors where say the 1st of December is not necessarily referring to 1 on the grid etc.

I will start playing with some stuff tomorrow if time permits and see what I can get for you in a rough outline by using the calender.

I think we need to mark this as solved and open a new thread with the question of adding a function to convert the numbers on the grid to a date. (Remember that it was already done, just need to change the code a bit) The calender took a date and converted this to a number to be added to the grid. The new function will get the dates first and then handle the numbers and colours accordingly. Close this off, I'll see you on the new question.

This question has already been answered. Start a new discussion instead.