I tried the demo code in demo project but I can't add new item successfully. It just add new new NULL group and NULL item. Please give me an simple example code to add new item (text and image).
Thank you!
Oh sorry! I forgot it. This is the first time I participate in this site. I use C#. And the code is:
objectListView1.BeginUpdate();
objectListView1.AddObject(new string [] {"Hello","dfdsF" });
objectListView1.EndUpdate();
and
objectListView1.BeginUpdate();
OLVListItem item = new OLVListItem(new string [] {"Hello","dfdsF" });
objectListView1.Items.Add(item);
objectListView1.EndUpdate();
It's so different form ListView and EXListView which I can define a text or a image when creating new item. But in ObjectListView, I don't understand OBJECT?
I get ObjectListView anh it's demo code form here http://nchc.dl.sourceforge.net/project/objectlistview/objectlistview/v2.5/ObjectListViewFull-2.5.0.zip
I will show you what to do to add items. Try to create a class, then make getters and setters for the properties you want to show on your
ObjectListView
.SetObjects
method takes aList<T>
:Now this is my class, I called it
haha
, I've two properties in it (Name
andDetail
):Now
ShowGroups
inObjectListView
to falseName
and one forDetail
AspectName
and write exactly the same name of its property that you want to show from your classHere's the result:
If you want to use
AddObject()
, which takes an object, I'd write this:Happy coding :)
The best thing is to use an entity class. Then make a list of items and add this list to your
ObjectListView
.But before you do that, you have to setup the columns in your designer. Just add a column, and in the field
AspectName
enter the exact name of the attribute of your entity item.