Tuesday, March 8, 2011

WPF Datagrid and datatable in vb.net

WPF Datagrid and datatable in vb.net


To assign datatable to WPF datagrid we simple use property "defaultview".

sample in vb.net:


dim mdt as new system.data.datatable
mdt.columns.add("Column1")
mdt.columns.add("Column2")

mdt.rows.add("id 1", "text 1")
mdt.rows.add("id 2","text 2")

mdt.rows.add("id 3","text 3")


mydatagrid.itemssource = mdt.defaultview

No comments:

Post a Comment