I am using windows forms C#.
I am trying to wrap a text into a datagridview
cell but the text does not get wrapped.
I enabled the wrap mode and I set the datagridview
Rows
to autoSize
but the wraping still did not work
DataGridView.AutoSizeRowsMode = True;
dataGridView1.DefaultCellStyle.WrapMode = True;
It works only if I add "\n" somewhere in the text for example:
dataGridView1.SelectedRows[0].Cells[1].Value = "123456" +"\n" + "ABCDE";
But as shown in the screenshot it does not wrap if I enter this text into the cell with no "\n" :
dataGridView1.SelectedRows[0].Cells[1].Value = "123456789ABCDEFGHIJKLMN"
Anyone knows what is wrong or how can I enable cell wrapping without using \n
? please help . Thank you