I'm learning how to use the listView in a windowsForm and I have some problems that I hope to solve here. The first thing is when I'm creating the columns with the code below:
private void initListView()
{
// Add columns
lvRegAnimals.Columns.Add("Id", -3,HorizontalAlignment.Left);
lvRegAnimals.Columns.Add("Name", -3, HorizontalAlignment.Left);
lvRegAnimals.Columns.Add("Age", -3, HorizontalAlignment.Left);
}
When I run the program, the name of the columns are not visible, they are all at the left corner, and I have to "drag" them to be able to read the text. What have I done wrong?
And finally I wonder how I add items to the columns. Do I first create a object like
ListViewItem item1 = new ListViewItem(???);
item1.SubItems.Add("text");
Is each listViewItem objects a column or a row? How do I add rows of info? Preciate some help! Thanks!