Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Most optimal way to edit a cell

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

Most optimal way to edit a cell
Link Posted: 05-Aug-2006 01:55
I have column reordering on so i cannot access the columns by index.
Is this the fastest way to edit a value in a cell?

where row is int and ColName is string,
grid.Rows.Items[row][ColName] = value;

also grid.Begin/EndUpdate()is extremly confusing, should i use grid.Rows.Items.Begin/EndUpdate() instead?

when should/can i use Begin/EndInit()?

Joe
Link Posted: 05-Aug-2006 23:10
Fastest way to edit cell - direct access to the Node.Value:
[c#]
public void SetValue(FlyGrid flyGrid, NodeBase node, object value)
{
  int index = flyGrid.Columns.FieldMapIndexOf(\"someField\");
  object[] value = node.Value as object[];
  value[index] = value;
}

Also you can see another method in the FlyGrid Demo (performanceForm.cs, refreshDataBtn_Click method).

Do not use grid.Begin/EndUpdate(), use BeginInit/EndInit pair when you make block of cell updates.
Link Posted: 30-Oct-2006 03:07
This works great, but in addition what is the best way to change the ForeColor of the cell whose data is being changed?
Link Posted: 30-Oct-2006 03:23
You can find a lot of code samples in this forum on \"custom drawing\" phrase.
FlyGrid provides a several ways, the simplest - you can use CoolNode class from Spreadsheet sample and change format of cell to mark it as modified.