DataGridViewCellStyle.WrapMode Property

Definition

Gets or sets a value indicating whether textual content in a DataGridView cell is wrapped to subsequent lines or truncated when it is too long to fit on a single line.

public:
 property System::Windows::Forms::DataGridViewTriState WrapMode { System::Windows::Forms::DataGridViewTriState get(); void set(System::Windows::Forms::DataGridViewTriState value); };
public System.Windows.Forms.DataGridViewTriState WrapMode { get; set; }
member this.WrapMode : System.Windows.Forms.DataGridViewTriState with get, set
Public Property WrapMode As DataGridViewTriState

Property Value

One of the DataGridViewTriState values. The default is NotSet.

Exceptions

The property value is not a valid DataGridViewTriState value.

Examples

The following code example illustrates the use of this property.

this.dataGridView1.DefaultCellStyle.WrapMode =
    DataGridViewTriState.True;
Me.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True

Remarks

If WrapMode is False for a cell that contains text, the cell displays the text on a single line, and displays any embedded newline characters as box characters. If WrapMode is True for a cell that contains text, the cell displays newline characters as line breaks, but also wraps any lines that exceed the width of the cell.

Applies to

See also