2008-04-17 09:48:19耶 ♥

選取日期範圍

Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
’開始日期顯示
Label2.Text = MonthCalendar1.SelectionStart
’結束日期顯示
Label3.Text = MonthCalendar1.SelectionEnd


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
’利用Numericupdown設定開始日期
Dim d1 As Date = New Date(NumericUpDown1.Value, NumericUpDown2.Value, NumericUpDown3.Value)
’利用numericupdown設定結束日期
Dim d2 As Date = New Date(NumericUpDown4.Value, NumericUpDown5.Value, NumericUpDown6.Value)
’設定開始與結束日期
MonthCalendar1.SetSelectionRange(d1, d2)
End Sub