calendar control

prav_roy

Well-known member
Joined
Sep 10, 2005
Messages
70
Location
Mumbai
Programming Experience
1-3
hi,
i am using calendar control in my project , this control only allow you to scroll to previous/next month... if you want to see a date 10 year later you've to scroll the "month" 120 times! That's plan stupid to me...
you have any sollutions for this....
 
In the DateTimePicker you can just enter a new date, for the MonthCalendar you have provide an date input box yourself or you could do as in this example, use two buttons to jump back/forward one year:
VB.NET:
'get starting date, usually today
Dim dt As Date = Date.Now
 
Private Sub MonthCalendar1_DateChanged(sender, e) Handles MonthCalendar1.DateChanged
  'get new date if user selects one
  dt = e.Start
End Sub
 
Private Sub btnAddYear_Click(sender, e) Handles btnAddYear.Click
  'add one year to selected date
  MonthCalendar1.SetDate(dt.AddMonths(12))
End Sub
 
Private Sub btnDeductYear_Click(sender, e) Handles btnDeductYear.Click
  'deduct one year from selected date
  MonthCalendar1.SetDate(dt.AddMonths(-12))
End Sub
 
Back
Top