• kappa
  • Member Topic Starter
I have an iGrid listing all open forms in my project.
When the user closes a form, the form name is removed from my iGrid.
I would then like my iGrid to load the previously selected form (user would normally click the cell in iGrid to load the form).
I have code like this so far:

If frmMainMDI.mGrid.SelectedCells.Count > 0 Then
            y = frmMainMDI.mGrid.SelectedCells(0).RowIndex
        End If

        'Need to emulate mGrid_CellClick event to load previous selected form

        frmMainMDI.mGrid.Cells(y - 1, 0).Selected = True
        frmMainMDI.mGrid.Cells(y - 1, 0).ImageIndex = 2 'selected icon

In listview I would use:
frmMainMDI.lvWin.Items(0).Selected = True

Your help would be appreciated.
Thank you
I beleive you can assign grid's CurCell property to the cell. In your example it would be (y-1,0).
Also you can call onclick method mGrid_CellClick by yourself....
  • kappa
  • Member Topic Starter
Thanks for your help Sergiy,
I have tried:
frmMainMDI.mGrid.CurCell = frmMainMDI.mGrid.Cells(y - 1, 0)

but nothing happens..
Could you please explain how to call the onclick method mGrid_CellClick event?
When you assing CurCell, you change current cell in grid, so this code need to be in your code.

Also you can move code from the mGrid_CellClick method to some another method (for example
with name DoCellClick(some params)). And call this DoCellClick from mGrid_CellClick and from your
code that is called when form deleted...