Avatar of yaronusa
yaronusa

asked on 

inherited control not recognized in c# csharp .net

I created an inherited TreeView control I call WaferTreeView. After creating it, I see it available in my toolbox. I then drag it onto my main form, and it is autmatically called WaferTreeView1.

Once I look at any other file in my project, I cannot view my main form in design view, because of this listed error: "The variable 'waferTreeView1' is either undeclared or was never assigned."

I only dragged and dropped the inherited WaferTreeView onto the form, and like any other control, I expect the designer to have the code it needs to make it work.

Upon examining the designer code of the form containing the WaferTreeView control, I noticed that the WaferTreeView type is unknown (in black instead of light blue color).

Why is this?? What should I do? Please help.
// Can't view main form because of this error:
// The variable 'waferTreeView1' is either undeclared or was never assigned.
 
 
// As you can see below, 'waferTreeView1' IS declared and assigned:
namespace MainForm
{
  partial class frmGridTester
  {
    ...
    private void InitializeComponent()
    {
      ...
      this.waferTreeView1 = new WaferTree.WaferTreeView();
      this.table.Controls.Add(this.waferTreeView1, 0, 1);
      ...
    }
    
 
    // WaferTreeView is an unknown type (therefore shown in
    // black color instead of light blue). WHY??
    private WaferTreeView waferTreeView1;
    
  }
}
 
 
namespace WaferTree
{
  public partial class WaferTreeView : TreeView
  {
 
    public WaferTreeView(): base()
    {
      InitializeComponent();
    }
  
    ...
  }
 
  public class WaferTreeNode : TreeNode
  {
    ...
  }
}

Open in new window

.NET ProgrammingC#

Avatar of undefined
Last Comment
pvginkel

8/22/2022 - Mon