定义了个类对象,怎么把值取出到datagridview中显示?
public class Poi
{
public string address;
public string distcode;
public double lat;
public double lon;
public double matchweight;
public string name;
public string tel;
public Poi();
}
------解决方案--------------------要么用个集合 然后循环GRIDVIEW 给赋值吧。。
------解决方案--------------------datasource 属性啊
------解决方案--------------------list<Poi> list = new list<Poi>;
Poi p = new Poi();
p.address = "xx";
...
list.add(p);
....
gridview1.datasource= list ;
gridview1.databind();
给gridview绑定类poi的集合
------解决方案--------------------List <Poi> poiLst = new List <Poi> ();
poiLst.add(new Poi(){...填加对应的值});
datagridview.datasource = poiLst ;