Click here to Skip to main content
Licence CPOL
First Posted 25 Apr 2002
Views 125,256
Downloads 4,283
Bookmarked 16 times

OCX Calendar VB

By | 25 Apr 2002 | Article
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)

About the Author

Fernando Finelli

Web Developer

Argentina Argentina

Member

Lic. Fernando Finelli

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHow to call OCX Calendar component PinmemberGopabandhu21:22 30 Aug '05  
GeneralPorteño Brisco! PinsussTrompis5:47 12 Aug '04  
GeneralHelp! NullReference Exception Pinsussdotgiveman13:34 16 Mar '04  
QuestionVB ??? Pinmemberdatxp6:41 10 Feb '03  
Generalbest article I ever read PinmemberAnonymous11:53 29 Apr '02  
GeneralRe: best article I ever read PinmemberRavi Bhavnani12:22 29 Apr '02  
GeneralRe: best article I ever read PinmemberCarlos Antollini17:33 20 Jul '02  
GeneralRe: best article I ever read Pinsussmarker2711:32 21 Jul '03  
GeneralRe: best article I ever read PinmemberFernando Finelli7:54 16 Jul '04  
GeneralRe: best article I ever read PinmemberFernando Finelli7:55 16 Jul '04  
GeneralRe: best article I ever read PinmemberSamurai Fugu14:39 12 Sep '06  

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.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120528.1 | Last Updated 26 Apr 2002
Article Copyright 2002 by Fernando Finelli
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid