views:

24

answers:

2

I have 2 grids on a form.

Both grids are binded to object Panel and PanelLines.

If user click first panel grid, the second panel line grid will show the related panel lines.

If the user clicks the panel grid on the same cell again, I want panel line grid to scroll rows as such visible rows hide and bottom rows show up.

The following code does the scrolling part.

dgvPanelItem.FirstDisplayedScrollingRowIndex = dgvPanelItem.DisplayedRowCount(False) - 1

But I need help in finding out, if first grid ( panel grid ) is already clicked or not.

A: 

Put a static variable flag, this should solve the specified problem

Maxymus
A: 

Thanks for your time.

I thought the same solution, but my implementation is not working exactly. In the Datagridview click cell event I have the following code

 Static Dim selectedPanel As ReceiptPanel
 Dim panel As ReceiptPanel = TryCast(bsPanel.Current, ReceiptPanel)
 If selectedPanel Is Nothing Then
      selectedPanel = panel
 Else
      grid.FirstDisplayedScrollingRowIndex = grid.DisplayedRowCount(False) - 1
      selectedPanel = Nothing
 End If

It would be a great help if you could give some code sample either C# of VB

Muthu Annamalai