c# - The Calendar Type for input it to database -
for project use monthcalendar this:
from toolbox in order make project more have variances on date time rather use datetimepicker it. datetimepicker option, use method
datetime dates = dtpdate.value;
and then, save value loc newr.rentdate = dates;
while use monthcalendar option, can't use method because option have option of autocomplete code .
in case, use loc
newuser.dob = caldob.dateselected.value.tostring("dd/mm/yyyy");
but unfortunately, there error on dateselected part. said
error 12 event 'system.windows.forms.monthcalendar.dateselected' can appear on left hand side of += or -= e:\version\5.0\agenindo\kepegawaian.cs 206 38 agenindo
so how can pick date save in database format "dd/mm/yyyy". :d
you can subscribe of these events:-
caldob.dateselected += new system.windows.forms.daterangeeventhandler(this.caldob_dateselected); caldob.datechanged += new system.windows.forms.daterangeeventhandler(this.caldob_datechanged);
and handlers like
private void caldob_dateselected(object sender, system.windows.forms.daterangeeventargs e) { //e.start; //gives start date //e.end ; //gives end date } private void caldob_datechanged(object sender, system.windows.forms.daterangeeventargs e) { //e.start; //gives start date //e.end ; //gives end date }
the other properties can problem are
maxselectioncount :- gets or sets maximum number of days can selected in month calendar control.
mindate : - gets or sets minimum allowable date.
Comments
Post a Comment