We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

gridpad sample

I was copying some code from your gridpad sample about how to put copy/paste in the menu. I had one question about why you did something and hoped you could answer it. Why do u do the following. Dim grid As GridControlBase = ActiveGrid If Not (grid Is Nothing) Then grid.Model.CutPaste.Copy() End If End Sub ''InvokeAction Why do u check the grid for is nothing? We never allow in our grids the user to not have a cell selected. So when a form comes up a cell is selected and if they click a button or something on the the form with the grid, the cell stays selected. So why do you check for is nothing? Is this just a standard practice to follow and if i dont could this cause a potential problem that i havent yet encountered? Phil

1 Reply

AD Administrator Syncfusion Team June 15, 2004 03:28 PM UTC

I think this code is specific to the GridPad implementation of the ActiveGrid property. If you look at the definition of the property ActiveGrid, you will see that the getter has code to try to return a parent form''s active control, and if this control is not a GridControlBase, this method returns null. So, maybe one of the MDI child documents has controls other than grids on them, and this control is the the form''s active control. In this case, the ActiveGrid property would return null.

Live Chat Icon For mobile
Up arrow icon