DataGridView C#
Change font size and row Height
For specific cell and rows in List1
2
3
4
5
6
7
8
9
10DataGridViewCellStyle style = new DataGridViewCellStyle();
style.Font = new Font(dataGridView1.Font.FontFamily, 14, FontStyle.Bold);
foreach (var item in HeadlineRow)
{
DataGridViewRow row = dataGridView1.Rows[item];
dataGridView1.Rows[item].Cells[1].Style.ApplyStyle(style);
row.Height = 30;
}
Change column Width
For specific row in List1
2DataGridViewColumn column = dataGridView1.Columns[1];
column.Width = 600;
Automatic wrap Line
1 | dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True; |
https://stackoverflow.com/questions/2154154/datagridview-how-to-set-column-width
Check for empty Cell
Columns = Enum1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
if (!dr.IsNull("ColumnName"))
{
dt.Rows.Add(dr);
dr = dt.NewRow();
CurentColumn = Columns.none;
if (Headline)
{
HeadlineRow.Add(rowNum);
Headline = false;
}
rowNum++;
}
Drag & Drop
Read data from Text File and put it to datagridview
How to read /load text (*.txt) file values in datagridview using C# ..?
install_url
to use ShareThis. Please set it in _config.yml
.