kappa
  • kappa
  • Member Topic Starter
2020-07-23T12:37:55Z
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
            frmMainMDI.mGrid.Rows.RemoveAt(y)
        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
frmMainMDI.lvWin.Select()

Your help would be appreciated.
Thank you
Sergiy/10Tec
2020-07-24T03:40:59Z
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
  • kappa
  • Member Topic Starter
2020-07-24T10:41:30Z
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?
Sergiy/10Tec
2020-07-24T11:29:22Z
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...