Skip to main content Skip to footer

Remove tabbing functionality from C1Schedule

Background:

C1Schedule has an inbuilt feature that upon pressing Tab key focus moves to the next appointment and it also gets selected. Handling control key events like KeyDown, KeyPress and KeyUp do not successfully prevent selecting appointments through Tab key.

Steps to Complete:

So, to prevent the end-user from selecting appointment through Tab key view the following code:

Override ProcessCmdKey and check whether C1Schedule has focus. If it contains focus, handle tab key

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    //capture arrow key press only for C1Schedule
    if (c1Schedule1.ContainsFocus)
    {
         //capture Tab key
         if (keyData == Keys.Tab)
         {
            return true;
         }
         return base.ProcessCmdKey(ref msg, keyData);
    }
    else
    {
         return false;
    }
}

Tags:

Ruchir Agarwal