如何在不使用网格刷新的情况下向DataGridView添加图像框图像?
因此,我正在尝试将picturebox映像添加到DataGridView,而无需使用DataGridView的刷新方法,而没有SQL干预 因此,只需在DataGridView中添加一个picturebox映像,这就是我已经设法按了一行,该行中显示了datagridview外显示的图片框图像 现在我需要相反:我需要一些简单明了的东西 字符串tenthcolumn = picturebox2.image;
private void AddARow(DataTable table)
{
// Use the NewRow method to create a DataRow with
// the table's schema.
// Add the row to the rows collection.
string firstColum = textBox1.Text;
string secondColum = textBox2.Text;
string thirdColum = textBox3.Text;
string fourthColum = textBox4.Text;
string dateColum = dateTimePicker1.Value.ToShortDateString();
string fifthColum = comboBox2.Text;
string sixthColum = comboBox3.Text;
string seventhColumn = comboBox4.Text;
string eighthColumn = comboBox5.Text;
string ninethcolumn = textBox5.Text;
string tenthcolumn = pictureBox2.Image;//this
string[] row = { firstColum, secondColum, thirdColum, fourthColum, dateColum, fifthColum, sixthColum,seventhColumn,eighthColumn,ninethcolumn,tenthcolumn };
table.Rows.Add(row);
}
So i'm trying to add an picturebox image to datagridview without having a refresh method of my datagridview and without sql intervention
so just add a picturebox image in a datagridview thats it, i already managed to press in a row and that picture box image that is in the row shows in a picturebox outside the datagridview
now i need the opposite : i need something simple and clear like
string tenthcolumn = pictureBox2.Image;
private void AddARow(DataTable table)
{
// Use the NewRow method to create a DataRow with
// the table's schema.
// Add the row to the rows collection.
string firstColum = textBox1.Text;
string secondColum = textBox2.Text;
string thirdColum = textBox3.Text;
string fourthColum = textBox4.Text;
string dateColum = dateTimePicker1.Value.ToShortDateString();
string fifthColum = comboBox2.Text;
string sixthColum = comboBox3.Text;
string seventhColumn = comboBox4.Text;
string eighthColumn = comboBox5.Text;
string ninethcolumn = textBox5.Text;
string tenthcolumn = pictureBox2.Image;//this
string[] row = { firstColum, secondColum, thirdColum, fourthColum, dateColum, fifthColum, sixthColum,seventhColumn,eighthColumn,ninethcolumn,tenthcolumn };
table.Rows.Add(row);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在问一个问题的同时发现了我使用数据表的方式:
使用System.io添加;
i found while asking the question lol, by the way i was using a datatable :
add using system.io;