Solved

Calendar browse

Posted on 2004-10-15
5
256 Views
Last Modified: 2010-04-15
Hi Experts,

I would implement the following :

When calendar pops up I would

1  enable month / year back forward scrolling using left / right arrows on keyboard
2  enable when Escape key is pressed to close calendar

Thank you.
0
Comment
Question by:fpoyavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:tomvergote
ID: 12321244
What tech are you using? winforms or webforms?
there are rudimentary standard ones included with the framework
ASP .NET
http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/webctrl/calendar/doc_cal.aspx

winforms:
look for monthcalendar here:
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsSamples.aspx
but you need to install the sdk to view it

both can be dropped on a form from the toolbox
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 12321709
The question is how do I accomplish

1  enable month / year back forward scrolling using left / right arrows on keyboard
2  enable when Escape key is pressed to close calendar

0
 
LVL 8

Expert Comment

by:tomvergote
ID: 12323687
euh, client side javascript, has nothing to do with c#
0
 
LVL 3

Accepted Solution

by:
aacool earned 500 total points
ID: 12324112
You can use the System.Windows.Forms.MonthCalendar Control or the DateTimePicker control
The MonthCalendar Control automatically handles left/right arrow effects.
To navigate one month at  a time when using the left/right arrows, set

      this.monthCalendar1.ScrollChange = 1;

Assuming you have the calendar control pop up as a dialog, you need to handle the KeyUp event in your form code. You can choose to do this either at the form level or at the calendar control level.

To handle keyboard events only at the form level and not allow other controls to receive keyboard events, set the KeyPressEventArgs.Handled property in your form's KeyPress event-handling method to true.

In the relevant KeyUp method event handler,

private void monthCalendar1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
      switch(e.KeyCode)
      {
            case Keys.Right:
                  //increment displayed range by one month or other amt as needed
                                                break;
                                case Keys.Left:
                                               //decrement displayed range by one month
                                                break;
                                case Keys.Escape:
                                               // close popup window on escape
                                               this.Close();
                                               break;
      }
}


0
 
LVL 3

Expert Comment

by:aacool
ID: 12352378
Did this work out for you?
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question