Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to close form with esc key in Datagrid
Message
From
25/11/2006 12:54:13
 
 
To
22/11/2006 13:55:09
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 1.1
Miscellaneous
Thread ID:
01171053
Message ID:
01172412
Views:
10
This message has been marked as the solution to the initial question of the thread.
Andrus,

>Thank you. It works.
>But how to close form from DataGrid ProcessCmdKey() method?


Well, just off the top of my head, I'd say that you could put a MyParentForm property on your Grid sub-class and when you drop your grid on a form, remember to set that property. Then you can call the MyParentForm.Close() method. That should do the trick.

~~Bonnie


>>Hi Andrus,
>>
>>Basically, you have to override the ProcessCmdKey method in your DataGrid sub-class ... see this article for more information:
>>
>>http://www.codeproject.com/cs/database/DatabaseAcessWithAdoNet1.asp#Keystrokes
>
>Thank you. It works.
>But how to close form from DataGrid ProcessCmdKey() method?
>
>I used
>((Form)this.Parent.Parent.Parent) .Close();
>
>
>If grid is not placed in tabpage then this code does not work.
>How to find grid parent form ?
>In Visual FoxPro this is easy becauses VFP has thisform
>
>However, DataGrid does not have parentform property.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform