Solved

Calendar browse

Posted on 2004-10-15
5
245 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
  • 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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