I have a C# windows forms app with a data grid. One column of the grid is an image column which I put a bitmap in. It works fine on the Windows 10 machine I developed it on and when I deploy it on Windows 7 machines, but on all other Windows 10 machines I get an error. The error is "System.FormatException: Formatted value of the cell has a wrong type." I haven't been able to recreate the error on my development machine, so I'm not sure how to figure out what's wrong. I thought it might be occurring because some prerequisite was not included when I deploy it (it's a Click Once application), but I don't see anything missing. I thought maybe it couldn't find the links to the image, so I tried drawing them instead and still got the same error. I'm guessing it has to do with my bitmap column, but I don't know why it would work on my machine and Windows 7 machines and not other Windows 10 machines. Any ideas on what's happening and/or how to fix this?
Here is the designer for my grid:
Here is the DefaultCellStyle settings. I thought the NullValue might be the cause. I originally had System.Drawing.Bitmap in it. I tried using null, but still get an error.
Here's the code for how I populate that column.
Bitmap bmpCombineOnly = new Bitmap(1, 1);
Bitmap bmpYellow = new Bitmap(26, 26);
Graphics grYellow = Graphics.FromImage(bmpYellow);
grYellow.DrawEllipse(new Pen(Color.Yellow, 2), 0, 0, 25, 25);
grYellow.FillEllipse(new SolidBrush(Color.Yellow), 0, 0, 25, 25);
bmpCombineOnly = bmpYellow;
foreach (DataGridViewRow row in ItemsInLocationDataGridView.Rows)
{
row.Cells["Icon"].Value = bmpCombineOnly;
}