目的很简单,.
就是在
DataGridView3加载完数据以后,在右边加入一列来专门显示图片.图片路径好处理.
但是这个列按照下面代码运行没加上.不知道什么问题.求指教.
DataGridView第一次用.
cmd.CommandText = sql;//sql语句
SqlDataReader dr = cmd.ExecuteReader();
BindingSource bs = new BindingSource();
bs.DataSource = dr;
this.dataGridView3.DataSource = bs;
DataGridViewImageColumn column = new DataGridViewImageColumn();
dataGridView3.Columns.Add(column);
column.HeaderText = "图片";
DataGridView3["Image", 0].Value = new Bitmap("图片路径");
------解决方案--------------------------------------------------------
column.Width=100;
column.Visible=true;
...
------解决方案--------------------------------------------------------
你得在DataTable里增加这一列。datasource绑定后。不能更改列了。。