Solved

Calendar browse

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now