listviewItem the only constructor?


New member
Apr 19, 2013
Programming Experience
It can't be helped. I've been searching for 2 days and haven't found the answer yet. All of the examples of listviews people are creating a listviewItem and adding data to it. When I try to add a listviewItem the only constructor I get requires a type of either Data, Insert or Empty. I select Data but then I don't have the methods for adding values or subitems which all of the examples show. In fact, if I copy an example of how to build a listview verbatim I just get errors that the constructor is wrong that the methods don't exist etc. How do I get the listview item that everyone else seems to have? Here is the constructor I am using if it helps to show what is going on with my machine:
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] item1 = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]ListViewItem[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]ListViewItemType[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].DataItem);[/SIZE]
That constructor is for an ASP.NET ListViewItem. Presumably you're looking at examples of WinForms ListViews. Web and Windows controls are quite different. Similar in many respects but very different under the hood.
Top Bottom