Hello i have got an problem i need to show the contents of an database table the name is Employees.
it needs to get shown in an list view or something simular.
i cant get the listview box to show the table contents.
I think following code should work for you:
private void BindTable(DataTable table) { lvItemList.Clear(); foreach (DataRow row in table.Rows) { ListViewItem lvItem = new ListViewItem(); lvItem.Text = row["ColumnName"].ToString(); lvItemList.Items.Add(lvItem); // Or in a one-liner //lvItemList.Items.Add(row["ColumnName"].ToString(); } }