Home - Forums-.NET - FlyGrid.Net (Windows Forms) - bug when adding new record to grid

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

bug when adding new record to grid
Link Posted: 19-Sep-2005 03:32
Hi,
When I add a new record to my grid, it is properly saved but then the first row is selected instead of staying on the current row. I can't find anywhere in my code where I reselect the first row and this behaviour occurs on every forms so I thought it might be bug in the flygrid
Can you help?

Thanks
Link Posted: 19-Sep-2005 23:18
I found out what causes the first row to be selected. When I save my selected row, I call mydataset.AcceptChanges, which is quite normal, and then the first row is selected, which is not expected. If I get rid of AcceptChanges, then everything works fine.
However I want to keep AcceptChanges, so could you have a look at it and tell me if it's a bug or if I should modify my code somehow?

Thanks
Link Posted: 21-Sep-2005 02:39
Could you help me regarding this issue please !
Link Posted: 21-Sep-2005 13:47
I'm very sorry for delays with answer,
This incrrectness already fixed and will avaliable in the nearest update (beginning of next week), now you can use following code:
[C#]
private void UpdateDataSet()
{
  int focusedRow = flyGrid.Rows.GetRowFromNode(flyGrid.Selected);
  'update dataset
  myDataSet.AcceptChanges();  
  if (focusedRow != -1)
  {
    NodeBase node = null;
    try
    {
      node = flyGrid.Rows.GetNoeFromRow(focusedRow);    
    }
    catch
    {
     //focusedRow can be more greater than current row count
    }
    if (node != null)
      flyGrid.Selected = node;
  }
}
Link Posted: 23-Sep-2005 00:35
thanks for the help. this code works fine. looking forward to the new version.