NextGrid & NextDBGrid








NextGrid .NET

NextGrid dot NET Quick Start

Related Articles:

  • Skill:
  • Version: 1.0.0
  • Author: Bojan Nikolic
  • Created: 2010-09-15
  • Updated: 2011-02-06
NextGrid.NET (WinForms) is powerfully grid component which may be used as standard two-dimensional grid, but it also have tree support.

This article will learn you how to work with NextGrid .NET (in both Design-time and Run-time) very quickly.


1. Placing control on form
2. Open Desing-time Columns Editor
3. Adding rows
4. Working with cells
5. Working with rows
6. Using events

1. Placing control on form

Click on NextGrid icon in Toolbox.

Then, click on form to place control on it.

Now, when grid is placed on form columns may be added and configured.

2. Open Design-time Columns Editor

Select nextGrid1 and click on button beside Columns property to open Design-time Columns Editor.

When Columns Editor is open you may click buttons on top to add desired column type into grid:

After columns are added, you may select desired column in Columns Editor and modify properties of it in Properties Window. Here are most common properties of column:

Table 1: Column properties
Property Meaning
Editing When set to true user will be able to edit cells in this column
Resizeable When set to false user will not be able to resize this column
Width Specify size of column in pixels

You will probably most want to set Column's title. To do this click on column, expand Header property and set Text property:

Next step in using NextGrid is adding rows and working with them.

3. Adding rows

Adding rows may be done easily. Next methods may be used for adding rows:

Table 2: Adding rows
Method Meaning
AddRow() Add 1 new row at the end of grid.
AddRow(numberOfRows) Add numberOfRows at the end of grid.
InsertRow(position) Insert 1 new row at specified position.


nextGrid1.AddRow(5); // Add 5 new rows at the end of grid
nextGrid1.InsertRow(3); // Add 1 new row at position 3

When new row is added, new cell for every column will be added.

3.1. Deleting rows

Row may be deleted by using DeleteRow(rowIndex) method:


3.2. Child rows

If you are want to use grid as tree-grid control, there are numerous methods and properties for that. More about this in this article.

4. Working with cells

Each cell in NextGrid is object with own properties such as properties for cell value or background color. Access to one of properties such as BackColor may be done by using 2-dimensional indexer property:

nextGrid1[3, 5].BackColor = Color.Blue;

Most important property of Cell is Value property. This property is object type and depending of the column type you may write:

nextGrid1[3, 5].Value = "test";
nextGrid1[3, 5].Value = 4;

5. Working with rows

As cells, each row is an object. Access to the row is done by single-dimensional indexer:

nextGrid1[5].Visible = false;

Here are some of row properties:

Table 3: Row properties
Property Meaning
RowHeight Specify height of row in pixels
Selected If true row will be selected

There is also property Cells for accessing cells. Example:

nextGrid1[1].Cells[2].Value = "value";

6. Using events

NextGrid produce many events such as for editing or selecting.

6.1. SelectionChanged event

One of the most importang event is SelectionChanged. This event occur when user select cell with mouse or keyboard. Integer x and y parameters indicate coordinates of selected cell.

6.2. BeforeEdit event

Second important event is BeforeEdit event. This event occur before grid enters into edit state. This event include (ref) accept parameter which may block editing. Example:

private void nextGrid1_BeforeEdit(object sender, CellEventArgs e,
    ref bool accept)
    if (e.Y == 2)
        accept = false;

Was This Article Useful?

Only constructive comments, code contributions... will be publishes. Questions, non-official discussion will not be published.