$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
DataGridView for C#.NET WinForms
Create custom data grid cells to GirdView in C# for your .NET Windows Forms applications
Home > WinForms UI Controls > User Manual > Grid Cells Access in C#

Gird Cells Accessing in C#.NET Projects

The Kettic DataGridView control provides the approaches of accessing grid cells by index or through the column Name property of the GridView. The Kettic GridView control will be put between the method invocations, BeginUpdate() and EndUpdate(), of the desired template if values are assigned to a few grid cells subsequently. The DataGirdView control uses virtualization to display the visual elements, so that only grid rows currently visible have a visual element. And when we scroll the grid, the visual elements will be reused. It is safe to use the CellElement only inside the CellFormatting event and for the current GridView cells.

How to Access Grid Cells by Index in C#

We are going through an example as following to learn how to access cells of DataGridView by Index in C# code. In the sample below, we are going to modify the second cell in the first row of GridView C# class and change the value that is larger than 20 back to 20.
C# code for accessing grid cells by index to GridView in .NET Windows Forms application.

if ((decimal)ketticGridView.Rows[0].Cells[5].Value > 20)
ketticGridView.Rows[0].Cells[5].Value = 20;

Access Grid Cells by Column Name

We are going through an example as following to learn how to access cells of DataGridView in C# projects by column name. In the sample below, we are going to return the value of a cell value to 20 when it is larger than 20. In this example, we will uses a column named as ProductPrice and then change the cells of the first row.
C# code for accessing gird cells by column name to GridView in .NET Windows Forms application

if ((decimal)ketticGridView1.Rows[0].Cells["ProductPrice"].Value > 20)
ketticGridView1.Rows[0].Cells["ProductPrice"].Value = 20;

Assign Values to Multiple Grid Cells

The Kettic GridView control will be put between the method invocations, BeginUpdate() and EndUpdate(), of the desired template if values are assigned to a few grid cells subsequently. This approach to assign values to various grid cells is better for performance considerations. This is mainly used in cases like following. When we added a sorting operation to GridView and change four grid cell values, this feature will accomplish the multiple values assignments at once. Otherwise, it will run four times
C# code for updating gird cells to GridView component in.NET Windows Forms application

ketticGridView1.TableElement.StartUpdate();
ketticGridView1.Rows[1].Cells["ProductPrice"].Value = 15;
ketticGridView1.Rows[2].Cells["ProductPrice"].Value = 25;
ketticGridView1.Rows[3].Cells["ProductPrice"].Value = 35;
ketticGridView1.Rows[4].Cells["ProductPrice"].Value = 45;
ketticGridView1.TableElement.EndUpdate();
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls