How display images in datagridview? c#

前端 未结 3 658
情深已故
情深已故 2020-12-19 10:22

I am developing an application in C # for desktop using Visual Studio Express 2010.

I have a table in MySQL called Products with 3 fields:

ID

3条回答
  •  被撕碎了的回忆
    2020-12-19 10:44

    You can add images with the following way:

    //you need to perform some parsing to retrieve individual values of ID, Name and ImagePath
    string path = @"c:\images\mousepad.jpg";
    string ID = "0001";
    string Product_Name = "Mousepad XYZ";
    dataGridView1.Rows.Add(ID, Product_Name, Bitmap.FromFile(path));
    

提交回复
热议问题