问题描述
我正在尝试更新由数据表填充的datagridview。
启动时显示的是(Properties.Resources.database)的图像,而不是(Properties.Resources.completed)的图像。
DataTable dtStores = new DataTable();
dtStores.Columns.Add("Total");
dtStores.Columns.Add("Store");
dtStores.Columns.Add("Status",typeof(Image));
DaTarow rStore = dtStores.NewRow();
rStore["Total"] = "";
rStore["Store"] = "Supermarket";
rStore["Status"] = Properties.Resources.database;
dtStores.Rows.Add(rStore);
dataGridView1.DataSource = dtStores;
DataGridViewRow dGRVStore = dataGridView1.Rows[0];
DataGridViewImageCell imgStatus = new DataGridViewImageCell();
imgStatus.Value = Properties.Resources.completed;
dGRVStore.Cells["Status"] = imgStatus ; dataGridView1.Refresh();
解决方法
dataGridView1 [“状态”,0] .Value = Properties.Resources.completed;