I noticed a problem with the grid on MDI child forms:
1. Create a C# Windows Application and set the startup form’s “IsMdiContainer” property to true. 2. Create a second form (I’ll call it the “child” form) with a couple of textboxes on it. 3. In the “Load” event of the main form, create two instances of the child form, assign the main form to the “MdiParent” property for both, and call the “Show” method on both. When you run the app, you will now get the main MDI window with two child windows inside it, each with two textboxes. 4. Arbitrarily set focus to the two textboxes, and then switch between the child windows. You will see that each child window “remembers” which textbox has the focus. 5. Now add a grid control to the child form. The behavior will be the same, except for that if you set focus to the grid, then switch to the other child window and back, the focus goes to the first textbox. (actually it sets the focus to whatever the first control in the tab order is — doesn’t have to be a textbox).
Another interesting thing is that if you make the grid the first control in the tab order, the focusing works correctly. But then there’s another quirk — if the grid is in edit mode and you have text selected, when you switch to the other child window and back, you’re still in edit mode but your text selection is gone.
Imported from legacy forums. Posted by Glenn (had 2001 views)