1

I'm trying to get a datagridview updated that is populated by the datatable.

When launching it shows the image of (Properties.Resources.database) and not (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();
Jay
  • 11
  • 1
  • 3
    The DGV is bound to a DataTable, so update the value stored in the DataTable not the DGV. – TnTinMn Aug 30 '20 at 02:18
  • Thank you. The reason why I want to capture all the data in the grid is to modify and display to the user, without modifying the DT and rebinding it. I can do with with text like dGRVStore.Cells["Total"].Value = "5"; but it there way for images? – Jay Aug 30 '20 at 03:39
  • One way I found was this.. dataGridView1["Status", 0].Value = Properties.Resources.completed; – Jay Aug 30 '20 at 03:51

1 Answers1

0

dataGridView1["Status", 0].Value = Properties.Resources.completed;

Jay
  • 11
  • 1