This is a migrated thread and some comments may be shown as answers.

Esc RadGridView

1 Answer 39 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rosendo Hernandez Gomez
Top achievements
Rank 1
Rosendo Hernandez Gomez asked on 04 Aug 2008, 03:39 PM
Hi, I have already open a thread about this subject but I canĀ“t find it on forums to see if you already gave me an answer, so here go my problem again.

I have a Form, and the form has the keypreview property set to true, so using the Form KeyDown event I close the form when user press Esc Key.

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
            if (e.KeyValue == 27)
            {
                FormCalificacionesRegistro.ActiveForm.Close();
            }
 }

The proble is when I use a RadGridView on the form, when I press Esc Key, I got the error

Objetc Reference not set to an instance of an object, doing reference to my MDI Parent Form called FormMenuPrincipal


static void Main()
{
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMenuPrincipal());
}

Thank you

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 05 Aug 2008, 08:20 AM
Hi Rosendo Hernandez Gomez,

Thank you for your interest in RadGrid.

We managed to reproduce the issue following your instructions.
We confirm that is the Grid issue and will be fixed in some of the next releases.

To avoid this issue  put e.Handled = true; before closing the form:

private void Form1_KeyDown(object sender, KeyEventArgs e) 
            if (e.KeyValue == 27) 
            { 
                e.Handled = true
                this.Close(); 
            } 

Hope this helps.

Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Rosendo Hernandez Gomez
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or