Hi
I have a image called check.jpeg in the resource folder. I have a datagridview which shows some values. Now when I right-click on the dgv I have a option called Checked-in upon clicking on this I want that image check.jpeg to be displyed on that rows third cell. How to do this
Thanks
Loading
Kirtan PatelPosted Sep 17, 2009, 7:48 AM
Here is What you want . If you don't Under stood the Code I also Included Project Files take a look at them Link is at bottom of the post :)
dont forget to mark "Do you like answer" please it will give me some credits :)
private void checkToolStripMenuItem_Click(object sender, EventArgs e)
{
dataGridView1.CurrentRow.Cells[0].Value = Properties.Resources.check;
}
private void uncheckToolStripMenuItem_Click(object sender, EventArgs e)
{
dataGridView1.CurrentRow.Cells[0].Value = null;
}
Download Project Files
Abdou AbdelkbirPosted Aug 27, 2015, 12:11 PM
Abdou AbdelkbirPosted Aug 27, 2015, 12:11 PM
bhavana kamblePosted Nov 12, 2010, 1:37 AM
plz
thanking u;
Kirtan PatelPosted Sep 18, 2009, 10:13 AM
You can Programatically add Image Column By Following Code
DataGridViewColumn Imagecolumn = new DataGridViewColumn(new DataGridViewImageCell());
Imagecolumn.DisplayIndex = 1;
Imagecolumn.HeaderText = "Image Column";
dataGridView1.Columns.Add(Imagecolumn);
and You Dont have to Set any Path to Image
Here you can see i Have Check.png Image Named "Check"
So, I just Have to
Write Code Like Below no need to set any path
private void checkToolStripMenuItem_Click(object sender, EventArgs e)
{
dataGridView1.CurrentRow.Cells[1].Value = Properties.Resources.check;
}
sachi vasishtaPosted Sep 18, 2009, 9:59 AM
I want to know how to have a datagridview's 2nd column as image type (I know I can do it in the properties of dgv but I want to do it by coding) And I have the images in the resource folder of the project. So what path(ImagePath) I have to give in this System.Drawing.Image.FromFile(ImagePath);
Thanks
Hirendra SisodiyaPosted Sep 17, 2009, 8:14 AM
i think you want to show some image on specified datagrid cell. right......
simple you can try if your datagridcell is taken by you as image type :
dataGridView1.Rows[index1].Cells[2].value= System.Drawing.Image.FromFile(ImagePath);
sachi vasishtaPosted Sep 17, 2009, 7:43 AM
private void checkedToolStripMenuItem_Click(object sender, EventArgs e)
{
DataGridViewRow row = dataGridView1.CurrentRow;
int index1 = row.Index;
dataGridView1.Rows[index1].Cells[2].value=?????? // what I have to write here in order to display that image(picturebox1)
}
this is my problem
Roei BarPosted Sep 17, 2009, 7:35 AM
have a look @ this post, i belive this is what you are looking for
http://www.codeproject.com/KB/database/DataGridEdtAlmostAnythin.aspx?df=100&forumid=157727&exp=0&select=1058499