DataGridViewRow Class

Represents a row in a DataGridView control.   The Cells property contains a collection of cells in the row.

After you add a DataGridView to a form (for example, DataGridView1), you add a row with two cells as follows:

method void AddRows()

var: DataGridViewRow row; // object variable used to store a row

 

Begin

row = DataGridViewRow.Create("") // instantiate row object

DataGridView1.Rows.Add(row); // add new row to the control

row.Cells[0].Value = "First Cell in Row";

row.Cells[1].Value = "Second Cell in Row";

End;

Namespace: elsystem.windows.forms

Properties

  Additional properties, methods, and events are described in the classes listed under Inheritance Hierarchy (see below).

  Name Type Description
Public property Cells object Gets the collection of cells that populate the row. See DataGridViewCellCollection.
Public property Frozen bool True when a row remains fixed when a user scrolls the DataGridView control vertically.
Public property Height int Gets or sets the height of the row in pixels.
Public property IsNewRow bool True if the row is a new row and false if the row is not a new row. The new row is the blank row at the bottom of the control when the DataGridView is set to allow users to add rows. This property should be checked prior to deleting/removing a row (i.e., ensure IsNewRow is false prior to removing) or an exception is thrown.
Public property MinimumHeight int Gets or sets the minimum height of the row.
Public property Resizable enum Gets or sets a TriState value indicating whether the row is resizable.
Public property Selected bool True if the row is in a selected state.
Public property Tag object Gets or sets a value or object that can be used to store data associated with the control.
Public property Text string Gets the name of the row.
Public property Visible bool Gets or sets a Boolean value indicating whether the row is visible.
Methods
  Name Description
Public property Create(string) Initializes a new instance of the DataGridViewRow class.
Public property SetCell(int, string) Sets the value of the row's indicated cell.
Inheritance Hierarchy

elsystem.Object

elsystem.DotNetObject

elsystem.windows.forms.DataGridViewRow