Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub ultraCalendarInfo1_BeforeAppointmentAdded(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.CancelableAppointmentEventArgs) Handles ultraCalendarInfo1.BeforeAppointmentAdded
'----------------------------------------------------------------------------------------------------
' 説明
' BeforeAppointmentAdded
'
' 新しい予定がコンポーネントの Appointments コレクションに追加される前に発生します
' キャンセルされる場合、Appointment は追加されずに、AfterAppointmentAdded イベントも発生しません
'
'----------------------------------------------------------------------------------------------------
If (e.Appointment.StartDateTime.DayOfWeek = System.DayOfWeek.Monday) Then
' Appointment の追加を回避するには、Cancel プロパティを
' True に設定します
e.Cancel = True
' ユーザーに状態を出力します
Dim info As String = String.Empty
info += "Sorry, but we are no longer accepting new appointments on "
info += e.Appointment.StartDateTime.DayOfWeek.ToString() + "s"
MessageBox.Show(info, "BeforeAppointmentAdded", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Sub