Examples: Using OLE custom controls

  1. This example creates a new calendar control in the Body field of a new document, or accesses the existing control in an existing document, and sets the first day of the week from Sunday to Monday.
    Sub Postopen(Source As Notesuidocument)
      Source.EditMode = True
      Call Source.GoToField("Body")
      If source.IsNewDoc Then
        Set Cal = Source.CreateObject _
        ("Calendar", _
        "MSCAL.Calendar.7")
      Else
        Set Cal = Source.GetObject _
        ("Calendar")
      End If
      Cal.FirstDay = 2
     End Sub
  2. This example handles the Click event for a calendar control component inserted in the form through the UI. The script displays the date which the user clicks on in the calendar control.
    Sub Click(Source As Calendar)
      Messagebox "You clicked on the following date: "_
      & Source.Month &"/" & Source.Day &"/"_
      & Source.Year
    End Sub