4 Replies - 1687 Views - Last Post: 28 April 2013 - 02:27 PM Rate Topic: -----

#1 Mohsin01  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 78
  • Joined: 13-April 12

Selecting Multiple dates from monthcalender in c# and store for use

Posted 28 April 2013 - 04:08 AM

Hey guys,

I need to select multiple date from c# tool monthcalander and store these dates somewhere so i can make use of these dates.
I have to enter employees multiple entries by dates. so user just wants to select multiple dates on calender and make entry.

Please Guide.
Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Selecting Multiple dates from monthcalender in c# and store for use

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3539
  • View blog
  • Posts: 10,952
  • Joined: 05-May 12

Re: Selecting Multiple dates from monthcalender in c# and store for use

Posted 28 April 2013 - 04:31 AM

C# doesn't have a calendar built into the language. Perhaps you are talking about a calendar control comes with the .NET Framework?

If the latter, are you using WinForms, Silverlight, WPF, WinForms, ASP.NET, or MVC? Is there a pattern to the dates, or are they random? Are you just looking to define a date range, or there random gaps?

This post has been edited by Skydiver: 28 April 2013 - 04:32 AM

Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3334
  • View blog
  • Posts: 11,300
  • Joined: 12-December 12

Re: Selecting Multiple dates from monthcalender in c# and store for use

Posted 28 April 2013 - 04:32 AM

MonthCalendars don't have a multi-select property, although MaxSelectionCount allows the user to select a (single) contiguous range of dates.

You can use the MouseDown event to add to the collected of bolded-dates:

private void monthCalendar1_MouseDown(object sender, MouseEventArgs e) {
  MonthCalendar.HitTestInfo info = monthCalendar1.HitTest(e.Location);
  if (info.HitArea == MonthCalendar.HitArea.Date) {
    if (monthCalendar1.BoldedDates.Contains(info.Time))
      monthCalendar1.RemoveBoldedDate(info.Time);
    else 
      monthCalendar1.AddBoldedDate(info.Time);
    monthCalendar1.UpdateBoldedDates();
  }
}

From this SO page; although, this apparently causes flicker.

Added: I assumed the OP was referring to the MonthCalendar of a WinForm.

This post has been edited by andrewsw: 28 April 2013 - 04:33 AM

Was This Post Helpful? 0
  • +
  • -

#4 Mohsin01  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 78
  • Joined: 13-April 12

Re: Selecting Multiple dates from monthcalender in c# and store for use

Posted 28 April 2013 - 07:39 AM

look at this image i attached. i can select dates but i don't know how to use them after selecting.
Attached Image

And C#.net proves multiple date selection. look here.
Attached Image
highlighted area: means we can slect 28 dates at a time.

And yes i am using winform C#.net with sql server compact.

So,please help if you can.
Thanks

This post has been edited by Mohsin01: 28 April 2013 - 07:48 AM

Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3334
  • View blog
  • Posts: 11,300
  • Joined: 12-December 12

Re: Selecting Multiple dates from monthcalender in c# and store for use

Posted 28 April 2013 - 02:27 PM

Quote

i can select dates but i don't know how to use them after selecting.

The first thing to decide is when you want to do something with the selected dates. Perhaps you have a button that the user can click on after they have selected the dates.

Then, in whichever event you decide to use, you can examine the SelectionRange of the MonthCalendar; this will give you the Start and End date/value that they have selected.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1