code
while (dr.Read())
{
string s = dr["Title"].ToString() + Environment.NewLine + dr["Description"].ToString();
row["Title"]= s.Trim();
dt.Rows.Add(row["Title"]);
}
i want to break the line in my datagridview.i have row value with “name subject”,i want to split it as “name”(newline)”subject” in the same row itself.
Is the problem that line returns are not being displayed in cells in your DataGridView?
If so you need to set the DataGridViewCellStyle.WrapMode Property of the Column you want to see line returns on to DataGridViewTriState.True.
After you do that the Cells in that column will display line breaks within a cell using
Environment.NewLine,\n, etc.