'ModelWithChildren' not found

BenTam 1,561 Reputation points
2021-07-01T09:13:48.677+00:00

Dear All, I am learning "ObjectListView" by working with the examples (http://objectlistview.sourceforge.net/cs/blog4.html#blog-rearrangingtreelistview). However the following error is shown.

The type or namespace name 'ModelWithChildren' could not be found

Could anybody tell me how to solve it?

TIA

110898-model.gif

The source code is as follows.

using System;  
using System.Collections;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Threading.Tasks;  
using System.Windows.Forms;  
  
namespace TreeListViewDragDrop  
{  
    public partial class Form1 : Form  
    {  
        public Form1()  
        {  
            InitializeComponent();  
            // Configure the first tree  
            treeListView1.CanExpandGetter = delegate (object x) { return true; };  
            treeListView1.ChildrenGetter = delegate (object x) { return ((ModelWithChildren)x).Children; };  
  
            // Configure the second tree  
            treeListView2.CanExpandGetter = delegate (object x) { return true; };  
            treeListView2.ChildrenGetter = delegate (object x) { return ((ModelWithChildren)x).Children; };  
  
            treeListView1.Roots = ModelWithChildren.CreateModels(null, new ArrayList { 0, 1, 2, 3, 4, 5 });  
            treeListView2.Roots = ModelWithChildren.CreateModels(null, new ArrayList { "A", "B ", "C", "D", "E" });  
        }  
    }  
}  
  
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,224 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,031 Reputation points
    2021-07-01T10:29:40.67+00:00

    If this is for ObjectListView then you need to add a reference to your project followed by adding a using statement to form1.