Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi guys
 
I want to put in my application (Visual basic.net 2010) an event Calendar.
Can anyone know where I find source code for this.
 
Thanks in advance
Posted 22-Jan-13 6:39am
jomachi1.6K
Comments
Sergey Alexandrovich Kryukov at 22-Jan-13 11:49am
   
Well, no platform, no UI library or application type tagged, no idea what's the problem. Nothing to talk about, unless you rather use "Improve question", above.
And, are you going to write source code? Or do you think everything should be found?
—SA
joshrduncan2012 at 22-Jan-13 12:17pm
   
My 5.
-JD
Sergey Alexandrovich Kryukov at 22-Jan-13 12:29pm
   
Thank you very much,
—SA
Kschuler at 22-Jan-13 15:10pm
   
You need to be more specific. Is this a windows forms project, web site,..etc? If you need some general information you can always try google for some articles to get you started.
CHill60 at 22-Jan-13 20:51pm
   
This comment would get a +5 from me ... it's a helpful comment, it's not a derogatory comment, it's not a sarcastic comment, thank you for reminding me that some of us do just want to help ... without just giving it to them on a plate and without just putting people down.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Below are some code snippets from one of my programs. This is not a complete solution. It is an example of one (of many) way to use the MonthCalendar Windows Form control to allow user input and validation of dates. This example uses one MonthCalendar control and moves it to be next to the TextBox that is selected via the associated Button control.
 
To your Windows Form:
  • Add MonthCalendar WinForms control to your Windows Form using Visual Studio Windows Form Designer named MonthCalendar.
  • Add TextBox WinForms control for start date named txtEffectiveDate
  • Add TextBox WinForms control for stop date named txtExpirationDate
  • Add Button WinForms control to bring up calendar for Start date named btnEffectiveDate
  • Add Button WinForms control to bring up calendar for Stop date named btnExpirationDate
  • Add Button WinForms control to complete transaction named btnOK
' Declare some global variables
' objTextbox is a reference to either the 
' txtEffectiveDate TextBox or the txtExpirationDate TextBox. 
' It is set in Click Event Handler
Dim objTextbox as Textbox 
Dim bError_EffectiveDate as Boolean ' True when Effective Date is invalid
Dim bError_ExpirationDate as Boolean ' True when Expiration Date is invalid
' Event for Date Selected
Private Sub MonthCalendar_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar.DateSelected
    bError_StartTime = False
    bError_StopTime = False
    objDateTextBox.Text = Format$(MonthCalendar.SelectionStart, "MM/dd/yyyy")
    Select Case objDateTextBox.Name
        Case "txtEffectiveDate"
            '
        Case "txtExpirationDate"
            '
        Case Else
            ' Do nothing
    End Select
    Call ToggleCalendarButtons(True)
    btnOK.Enabled = True
    txtStartTime.Focus()
End Sub
 
' Toggle show or hide the MonthCalendar control
Private Sub ToggleCalendarButtons(ByVal TRUEFALSE As Boolean)
    MonthCalendar.Visible = Not TRUEFALSE
    If Not TRUEFALSE Then
        MonthCalendar.BringToFront()
    End If
    btnEffectiveDate.Enabled = TRUEFALSE
    btnExpirationDate.Enabled = TRUEFALSE
    btnOK.Enabled = TRUEFALSE
    Try
        MonthCalendar.SetDate(CDate(objDateTextBox.Text))
    Catch
    End Try
    objDateTextBox.Focus()
End Sub
 
' Handle click event for Effective Date and Expiration Date buttons
    Private Sub btnEffectiveDate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEffectiveDate.Click
        btnEffectiveDate.Enabled = False
        If Not MonthCalendar.Visible Then
            MonthCalendar.Location = New Point(btnEffectiveDate.Location.X, btnEffectiveDate.Location.Y)
            objDateTextBox = txtEffectiveDate
            Call ToggleCalendarButtons(False)
        End If
        btnEffectiveDate.Enabled = True
    End Sub
 
    Private Sub btnExpirationDate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExpirationDate.Click
        btnExpirationDate.Enabled = False
        If Not MonthCalendar.Visible Then
            MonthCalendar.Location = New Point(btnExpirationDate.Location.X, btnExpirationDate.Location.Y)
            objDateTextBox = txtExpirationDate
            Call ToggleCalendarButtons(False)
        End If
        btnExpirationDate.Enabled = True
    End Sub
' Validate date in case use keyed it instead of selecting from the calendar
    Private Sub txtExpirationDate_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtExpirationDate.Validating
        If txtExpirationDate.Text.Length > 0 Then
            Try
                txtExpirationDate.Text = Format$(CDate(txtExpirationDate.Text.ToString), "MM/dd/yyyy")
                bError_ExpirationDate = False
            Catch myException As InvalidCastException
                MsgBox(myException.Message, MsgBoxStyle.Exclamation, "Expires Date")
                bError_ExpirationDate = True
            End Try
        End If
    End Sub
 
    Private Sub txtEffectiveDate_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtEffectiveDate.Validating
        If txtEffectiveDate.Text.Length > 0 Then
            Try
                txtEffectiveDate.Text = Format$(CDate(txtEffectiveDate.Text.ToString), "MM/dd/yyyy")
                bError_EffectiveDate = False
            Catch myException As InvalidCastException
                MsgBox(myException.Message, MsgBoxStyle.Exclamation, "Effective Date")
                bError_EffectiveDate = True
            End Try
        End If
    End Sub
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 23 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100