Click here to Skip to main content
Click here to Skip to main content

OCX Calendar VB

, 25 Apr 2002
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Fernando Finelli
Web Developer
Argentina Argentina
Lic. Fernando Finelli

Comments and Discussions

 
QuestionHow to call OCX Calendar component PinmemberGopabandhu30-Aug-05 21:22 
GeneralPorteño Brisco! PinsussTrompis12-Aug-04 5:47 
GeneralHelp! NullReference Exception Pinsussdotgiveman16-Mar-04 13:34 
QuestionVB ??? Pinmemberdatxp10-Feb-03 6:41 
Generalbest article I ever read PinmemberAnonymous29-Apr-02 11:53 
GeneralRe: best article I ever read PinmemberRavi Bhavnani29-Apr-02 12:22 
GeneralRe: best article I ever read PinmemberCarlos Antollini20-Jul-02 17:33 
GeneralRe: best article I ever read Pinsussmarker2721-Jul-03 11:32 
GeneralRe: best article I ever read PinmemberFernando Finelli16-Jul-04 7:54 
GeneralRe: best article I ever read PinmemberFernando Finelli16-Jul-04 7:55 
GeneralRe: best article I ever read PinmemberSamurai Fugu12-Sep-06 14:39 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 26 Apr 2002
Article Copyright 2002 by Fernando Finelli
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid