Data giridview
Data girid view colum1 column2 cloumn3.... how to image add into the columns..
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Raj Sonu13 reputationPosted Sep 1, 2014, 11:45 PM EDT
using System; using System.Data; using System.Windows.Forms; using System.Data.SqlClient; using System.Drawing; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { dataGridView1.ColumnCount = 3; dataGridView1.Columns[0].Name = "Product ID"; dataGridView1.Columns[1].Name = "Product Name"; dataGridView1.Columns[2].Name = "Product Price"; string[] row = new string[] { "1", "Product 1", "1000" }; dataGridView1.Rows.Add(row); row = new string[] { "2", "Product 2", "2000" }; dataGridView1.Rows.Add(row); row = new string[] { "3", "Product 3", "3000" }; dataGridView1.Rows.Add(row); row = new string[] { "4", "Product 4", "4000" }; dataGridView1.Rows.Add(row); DataGridViewImageColumn img = new DataGridViewImageColumn(); Image image = Image.FromFile("Image Path"); img.Image = image; dataGridView1.Columns.Add(img); img.HeaderText = "Image"; img.Name = "img"; } } }Farhan ShariffRank #2,004 · 725 reputationPosted Sep 2, 2014, 1:43 AM EDT
using System.Data;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Drawing;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DataGridViewImageColumn column1 = new DataGridViewImageColumn();
Image image = Image.FromFile("Image Path");
column1.Image = image;
dataGridView1.Columns.Add(column1);
column1.HeaderText = "Image";
column1.Name = "img";
}
}
}