c# - Populating DataGridView with custom DataGridColumn -
i have datagridview
custom datagridviewtexticoncolumn
(based on datagridviewtextboxcell
) includes text , little icon. , have collection of objects:
list<myclass> info = getdata(); class myclass { public string name { get; set; } public image icon { get; set; } }
and populating datagridview
use:
foreach (datagridviewrow r in dgvtest.rows) { r.cells[0].value = "test"; (r.cells[0] datagridviewtextboxcell).icon = testimage; }
but sense wrong , should exist more appropriate way it. how can bound list<myclass>
datagridview
custom datagridviewtexticoncolumn
should represents name
, icon
properties in 1 cell?
i'm sure if google this, come many hits on working solution.
using list info source datagridview
http://tech.pro/tutorial/776/csharp-tutorial-binding-a-datagridview-to-a-collection
http://msdn.microsoft.com/en-ca/library/y0wfd4yz(v=vs.90).aspx
c# winforms datagridview
No comments:
Post a Comment