How To Wrap Text In A DataGridViewColumn
Given that you have data such as comments/notes/description/address that would comprise at least hundreds of characters and you want to show them on the DataGridView control, you will notice that the text is concatenated and replaced with ellipses.
In order to achieve wrapping of text in a DataGridView cell, I achieved it using these steps.
1. Change the WrapMode value to True of a DataGridViewTextBoxColumn's DefaultCellStyle.
2. In my DataBindingComplete event of the DataGridView, set the AutoSizeRowsMode of the DataGridView to AllCells.
C# Code
That's it.. :-)
In order to achieve wrapping of text in a DataGridView cell, I achieved it using these steps.
1. Change the WrapMode value to True of a DataGridViewTextBoxColumn's DefaultCellStyle.
2. In my DataBindingComplete event of the DataGridView, set the AutoSizeRowsMode of the DataGridView to AllCells.
C# Code
private void dgvFormat_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { dgvFormat.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; }
That's it.. :-)
Comments
Post a Comment