Private Sub UltraMonthViewSingle1_BeforeAppointmentEdit(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeAppointmentEditEventArgs) Handles ultraMonthViewSingle.BeforeAppointmentEdit
'----------------------------------------------------------------------------------------------------
' 説明
' BeforeAppointmentEdit
'
' コントロール UI で Appointment の件名が編集される前に発生します
' イベントがキャンセルされた場合、Appointment の編集は無効になり、AfterAppointmentEdit
' イベントを発生しません
'
'----------------------------------------------------------------------------------------------------
' 予定が複数日をまたぐかどうかを決定します
If e.Appointment.StartDateTime.Date <> e.Appointment.EndDateTime.Date Then
' 複数日の予定であるため、予定を編集する許可がないことを通知し、
' イベントの 'Cancel' プロパティを True に設定すると、
' イベントをキャンセルします
MessageBox.Show("You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error)
e.Cancel = True
Return
End If
' 予定の曜日を取得します
Dim dow As System.DayOfWeek = e.Appointment.StartDateTime.DayOfWeek
' 予定が土曜日または日曜日以外の曜日にある場合、
' 編集を無効にします
If dow <> System.DayOfWeek.Saturday And dow <> System.DayOfWeek.Sunday Then
MessageBox.Show("You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error)
e.Cancel = True
Return
End If
End Sub