Click here to Skip to main content
15,881,852 members
Articles / Programming Languages / VBScript

OCX Calendar VB

Rate me:
Please Sign up or sign in to vote.
3.29/5 (7 votes)
25 Apr 2002CPOL 396.5K   6K   16   11
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:

VB.NET
Calendario.Generate (Date)

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

VB.NET
MsgBox Calendario.DateOutput

The code is very easy.

Display day of the month:

VB.NET
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Argentina Argentina
Lic. Fernando Finelli

Comments and Discussions

 
QuestionHow to call OCX Calendar component Pin
Gopabandhu30-Aug-05 21:22
Gopabandhu30-Aug-05 21:22 
GeneralPorteño Brisco! Pin
Trompis12-Aug-04 5:47
sussTrompis12-Aug-04 5:47 
GeneralHelp! NullReference Exception Pin
horngsh16-Mar-04 13:34
horngsh16-Mar-04 13:34 
QuestionVB ??? Pin
datxp10-Feb-03 6:41
datxp10-Feb-03 6:41 
Generalbest article I ever read Pin
29-Apr-02 11:53
suss29-Apr-02 11:53 
GeneralRe: best article I ever read Pin
Ravi Bhavnani29-Apr-02 12:22
professionalRavi Bhavnani29-Apr-02 12:22 
GeneralRe: best article I ever read Pin
Carlos Antollini20-Jul-02 17:33
Carlos Antollini20-Jul-02 17:33 
GeneralRe: best article I ever read Pin
marker2721-Jul-03 11:32
sussmarker2721-Jul-03 11:32 
GeneralRe: best article I ever read Pin
Fernando Finelli16-Jul-04 7:54
Fernando Finelli16-Jul-04 7:54 
GeneralRe: best article I ever read Pin
Fernando Finelli16-Jul-04 7:55
Fernando Finelli16-Jul-04 7:55 
GeneralRe: best article I ever read Pin
Samurai Fugu12-Sep-06 14:39
Samurai Fugu12-Sep-06 14:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.