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