Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Invalidating Cells?

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

Invalidating Cells?
Link Posted: 03-Feb-2006 08:32
What I am doing: I am using Flygrid for live financial market data and most of my cells are being calculated off the incoming data.

My problem? Bad Performance

When one cell changes, I have to invalidate a whole node and redraw the whole node. This is a major loss in performance.

What I need.

I need to be able to invalidate a cell and redraw one cell (not the whole node). This will increase my performance. The cell invalidation does not seem to be working or I might be doing something wrong...

Could anyone help?
Link Posted: 03-Feb-2006 19:13
I've checked your issue, FlyGrid.InvalidateCell and FlyGridViewPort.InvalidateCell work fine:
[C#]
//Reworked VirtualGrid sample
//modify this event handler
private object VM_GetNodeCellValue(object sender, NodeBase node, int index)
{
      //check individual cell displaying
      if (node.Index == 3 && index == 2)
        return DateTime.Now.ToLongTimeString();
      //check another cell displaying (shouldn't invaliated)
      if (node.Index == 3 && index == 3)
        return "C" + DateTime.Now.ToLongTimeString();
      Column col = virtualGrid.Columns.FieldMapColumnFromIndex(index);
      return string.Format("Cell[{0}],[{1}]", node.Index, col.Caption);
}

//Add new button and add this Cick event handler
//this handler runs invalidation of node with index =3 in the column with index = 2 each 10 milliseconds
private void button1_Click(object sender, System.EventArgs e)
{
      Timer timer = new Timer();
      timer.Interval = 10;
      timer.Tick += new EventHandler(timer_Tick);
      timer.Start();
}

//timer Tick event handler
private void timer_Tick(object sender, EventArgs e)
{
      virtualGrid.InvalidateCell(virtualGrid.Rows.Items[3], virtualGrid.Columns.Items[2]);
}


If you need invalidate cells in the nested grids you should use FlyGridViewPort.InvalidateCell
Anyway you can send us (to ) your sample to receive recommendations how to improve perofrmance on your sample.
Link Posted: 03-Feb-2006 20:06
this is the same issue I have. Why is the cell not simply invalidated when you set the cell value rather than having to do it manually all the time?
Link Posted: 03-Feb-2006 21:02
Run the Best Performance sample of the FlyGrid.Net Demo, fill grid and click Refresh Data button.
RefreshData refreshes cells of currently visible cells, without calling InvalidateCell, cell contents (NodeBase.SetValue or Column.SetValue method for example) changes automatically invalidate cell.
You can try modify Best Performance sample with method below to see how is invalidated individual cell:
[C#]
private void refreshDataBtn_Click(object sender, System.EventArgs e)
{
  // this method refreshes only one cell contents
  Random rnd = new Random();
  NodeBase node = performanceGrid.Rows.Items[3];
  performanceGrid.Columns.Items[0].SetValue(node, rnd.NextDouble().ToString());          
}
Link Posted: 04-Feb-2006 06:51
well, node["myColumn"] = "myValue" does not invalidate the cell and you told me before that this is the way that I should do it rather then SetCellValue.
Link Posted: 04-Feb-2006 17:22
I've checked all ways on this samples, here are results:
[c#]
//1. First way - works fine
node.SetCellValue(0, rnd.NextDouble().ToString());
//----------------------
//2. Second way - works fine
node["Column0"] = rnd.NextDouble().ToString();
//----------------------
//3. Third way - works fine
node[0] = rnd.NextDouble().ToString();
//----------------------
//4. Fourth way - works fine
performanceGrid.Columns.Items[0].SetValue(node, rnd.NextDouble().ToString());
//----------------------
Link Posted: 05-Feb-2006 07:40
well, all I can say is it does not work for me. It only invalidates occasionally or when I click on the cell
Link Posted: 05-Feb-2006 08:00
Can you provide us with a sample? Please send this sample to
This helps to solve this problem more quickly.
Link Posted: 06-Feb-2006 05:47
The program is very extensive and long, so while we could send you a sample it may not be conclusive since it is intergrated into the program.

We don't want to spend time rewritting code to create a working sample from the existing extensive program. Also, sending the whole program is not an option (1. because it is relies on a server application and 2 other 3rd party applications, 2. we have a non-disclosure agreement)

If we can not resolve the problem, then we may have to write a separate sample program for you to review.

As of now, no matter what we do the the value does not invalidate the cell.

Again, if you have any ideas for what we have emailed you please let us know.

It is creating some serious CPU usage using the invalidate node.
Link Posted: 06-Feb-2006 06:16
Please send following details:
[list=1]
  • Screenshot of flyGrid - to have structure of data used in your app
  • [/*:m]
  • What column types you've used.
  • [/*:m]
  • What mode you're using - virtual, databound or add nodes?
  • [list=a]
  • Ff virtual mode is used - can you send portions of code for displaying cells - VirtualMode_xxx event handlers.
  • [/*:m][/list:o][/*:m]
  • Nesting - you're using nested grids
  • [/*:m]
  • Node invalidation code.
  • [/*:m]
  • It will better if you provide these details in the sample app. this helps to more quickly solve problem.
  • [/*:m][/list:o]