Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

OCX Calendar VB

0.00/5 (No votes)
25 Apr 2002 1  
OCX User Control for Visual Basic

Sample Image - OCX_Calendar.jpg

Introduction

This is an OCX Calendar User Control for Visual Basic.

To call the calendar control:

Calendario.Generate (Date)

The DATE parameter is the day default selected.
To get the selected date:

MsgBox Calendario.DateOutput

The code is very easy.

Display day of the month:

For intI = 1 To intCantSemanas
    For IntJ = 1 To 7
        intCantAct = intCantAct + 1
        
        If intCantAct >= intDiaSemana Then
            intDay = intDay + 1
            
            If IsDate(intDay & "/" & strMonth & "/" & strYear) Then
                strFechaOut = intDay & "/" & strMonth & "/" & strYear
                lblDay(intCantAct) = intDay
                lblDay(intCantAct).ForeColor = &H80000008
                lblDay(intCantAct).ToolTipText = Format(strFechaOut, "dd/mm/yyyy")
            Else
                intCantDes = intCantDes + 1
                strFechaOut = intCantDes & "/" & _
			Month(DateAdd("m", 1, strFechaOut)) & "/" & strYear
                lblDay(intCantAct) = intCantDes
                lblDay(intCantAct).ForeColor = &HC0C0C0
                lblDay(intCantAct).ToolTipText = Format(strFechaOut, "dd/mm/yyyy")
            End If
        Else
            strFechaOut = DateAdd("d", intCantAct - intDiaSemana, strDate)
            lblDay(intCantAct) = Day(DateAdd("d", intCantAct - intDiaSemana, strDate))
            lblDay(intCantAct).ForeColor = &HC0C0C0
            lblDay(intCantAct).ToolTipText = Format(strFechaOut, "dd/mm/yyyy")
        End If
        
        If lblDay(intCantAct) = strDay Then
            lblDay(intCantAct).BackColor = &H80000008
            lblDay(intCantAct).ForeColor = &HFFFFFF
        End If
    Next IntJ
Next intI

History

  • 25th April, 2002: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here