0

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.

0

2 Answers 2

3

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(); } } 
Sign up to request clarification or add additional context in comments.

Comments

0

You need to override the toString() method and provide the string data you want to display.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.