Click here to Skip to main content
13,249,813 members (85,205 online)
Click here to Skip to main content
Add your own
alternative version

Stats

163.8K views
5.4K downloads
16 bookmarked
Posted 25 Apr 2002

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

You may also be interested in...

Comments and Discussions

 
QuestionHow to call OCX Calendar component Pin
Gopabandhu30-Aug-05 22:22
memberGopabandhu30-Aug-05 22:22 
GeneralPorteño Brisco! Pin
Trompis12-Aug-04 6:47
sussTrompis12-Aug-04 6:47 
GeneralHelp! NullReference Exception Pin
dotgiveman16-Mar-04 14:34
sussdotgiveman16-Mar-04 14:34 
QuestionVB ??? Pin
datxp10-Feb-03 7:41
memberdatxp10-Feb-03 7:41 
Generalbest article I ever read Pin
Anonymous29-Apr-02 12:53
memberAnonymous29-Apr-02 12:53 
GeneralRe: best article I ever read Pin
Ravi Bhavnani29-Apr-02 13:22
memberRavi Bhavnani29-Apr-02 13:22 
GeneralRe: best article I ever read Pin
Carlos Antollini20-Jul-02 18:33
memberCarlos Antollini20-Jul-02 18:33 
GeneralRe: best article I ever read Pin
marker2721-Jul-03 12:32
sussmarker2721-Jul-03 12:32 
GeneralRe: best article I ever read Pin
Fernando Finelli16-Jul-04 8:54
memberFernando Finelli16-Jul-04 8:54 
GeneralRe: best article I ever read Pin
Fernando Finelli16-Jul-04 8:55
memberFernando Finelli16-Jul-04 8:55 
GeneralRe: best article I ever read Pin
Samurai Fugu12-Sep-06 15:39
memberSamurai Fugu12-Sep-06 15: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.

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