I am using a datagridview for which I am not using any datasource. I want to dynamically allocate values to it. Create my own selected number of columns and rows and name them. Plus I want to add images to cells instead of data .
As for changing columns text we can use
grid.Columns[0].HeaderText = "First Column";
How to change use it for labeling rows?
Set the HeaderCell.Value
for the row:
DataGridView dgv = new DataGridView();
dgv.Columns.Add("Foo", "Foo Text");
dgv.Rows.Add();
dgv.Rows[0].HeaderCell.Value = "Row Text";
Form form = new Form();
form.Controls.Add(dgv);
Application.Run(form);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.