Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1150
  • Last Modified:

How To Make Use Of GetDayBold Event For Retrieved Dates From Access Database?

I'm doin a date reminder software using vb6. i'm using access database to store reminders. i have a calendar in display (monthview). If there is a reminder on that day, i want the date to be displayed bold on the calendar.

I tried using DayBold property but i realised that it will only bold the days which are visible(in view) on the calendar. So i got to know about GetDayBold event which is used to set the boldness of days as they are brought into view. But i am not sure how to get it work for my situation even though i tried to.

Does anyone know how to make use of the getdaybold event of monthview control to bold the dates retrieved from the database?

This is how i retrieve the stored date from the database, the statements to create connection and stuff are in a module. The statements below are used in form.

strSelect = "SELECT * FROM remind " 'select statement
    lngRemindSelect = ExecuteSelectQuery(strSelect, retrieved()) ' retrieved variables from strSelect
   
        For Row = 0 To lngRemindSelect - 1 ' from 1st to last row in the remind table in database
           
           
            SelectedDate = ConvertToString(retrieved(1, Row)) 'setting all the date values in Column 1 to variable SelectedDate
           
           
        Next Row

Thanks in advance.

Humanity
0
InHuman
Asked:
InHuman
1 Solution
 
itzmeCommented:
I wouldn't use the GetDayBold method why not try the DayBold property of the monthview i.e to set todays date to bold put this code in an action event (i.e click.. it doesnt seem to work inside a form_load sub):

Dim i As Date

i = Date

monthView1.DayBold(i) = True
******************************
In your code this should probable work:
strSelect = "SELECT * FROM remind " 'select statement
   lngRemindSelect = ExecuteSelectQuery(strSelect, retrieved()) ' retrieved variables from strSelect
   
       For Row = 0 To lngRemindSelect - 1 ' from 1st to last row in the remind table in database
           
           
           SelectedDate = ConvertToString(retrieved(1, Row)) 'setting all the date values in Column 1 to variable SelectedDate
           MonthView1.DayBold(SelectedDate)
           
       Next Row
***************************************
where "monthview1" is the name of your monthview
0
 
InHumanAuthor Commented:
Hi itzme.

What i need is for it to work without going to any action event and by form_load sub itself. Since this is not possible, i can only rely on GetDayBold event. But from what i have searched, i can only find source codes which bold dates like, all fridays or all saturdays etc.

anyway, thanks.

Humanity
0
 
InHumanAuthor Commented:
And one more thing, i mentioned i am using a calendar, I need the days to be bold as they are brought into view. Anyone? Thanks..

Humanity
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
itzmeCommented:
This should work (and do what you want):
/********************************************************************************************/
Private Sub MonthView1_GetDayBold(ByVal startDate As Date, ByVal Count As Integer, State() As Boolean)
 Dim i As Integer  
Dim dateSelected As Date
strSelect = "SELECT * FROM remind " 'select statement
  lngRemindSelect = ExecuteSelectQuery(strSelect, retrieved()) ' retrieved variables from strSelect
 
      For Row = 0 To lngRemindSelect - 1 ' from 1st to last row in the remind table in database
         
          SelectedDate = ConvertToString(retrieved(1, Row)) 'setting all the date values in Column 1 to variable SelectedDate
       dateSelected = CDate(selectedDate)
       i = make_bold(dateSelected)
       State(i - 1) = True          
         
      Next Row
 
   
   
End Sub


Public Function make_bold(ByVal dateBold As Date) As Integer
    Dim i As Integer
    Dim temp As String
    Dim answer As Date
   
    For i = 1 To 42
    Debug.Print MonthView1.VisibleDays(i)
        temp = CStr(MonthView1.VisibleDays(i))
        answer = CDate(Trim(Mid(temp, 1, 10)))
        If answer = dateBold Then
            make_bold = i
        End If
    Next i

End Function
/****************************************************************************************************/
0
 
itzmeCommented:
Get rid of the Debug.print line in the make_bold function, sorry forgot that was in there
0
 
CleanupPingCommented:
Hi InHuman,
This old question (QID 20562093) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept itzme's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now