How do I add a DataTable to a ListView?

  • Thread starter Thread starter Jonas Andersson
  • Start date Start date
J

Jonas Andersson

Guest
How do I add a DataTable to a ListView?

Consider this code:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
addData();
}

public void addData()
{
DataTable dt = new DataTable();
dt.Columns.Add("Column 1");
dt.Columns.Add("Column 2");
dt.Rows.Add(new object[] { "Dummy", "Data"});
dataGridView1.DataSource = dt;
}
}


If I would do the same with a ListView, and add the same data to it, how would I go about to do that?
"listView1.DataSource" doesnt seem to work.

Continue reading...
 
Back
Top