{"id":4308,"date":"2014-03-30T09:46:19","date_gmt":"2014-03-30T09:46:19","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/custom-user-control-cannot-be-found-in-the-solution-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:46:19","modified_gmt":"2014-03-30T09:46:19","slug":"custom-user-control-cannot-be-found-in-the-solution-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/custom-user-control-cannot-be-found-in-the-solution-collection-of-common-programming-errors\/","title":{"rendered":"Custom user control cannot be found in the solution?-Collection of common programming errors"},"content":{"rendered":"<p>I created a simple Sudoku application, where each 3&#215;3 squares is a user control, with this skeleton code in <code>CellBlock.Designer.cs<\/code> and nothing but the automatically generated code in <code>CellBlock.cs<\/code>:<\/p>\n<pre><code>namespace Sudoku\n{\n    partial class CellBlock\n    {\n\n        private System.ComponentModel.IContainer components = null;\n\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing &amp;&amp; (components != null))\n            {\n                components.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n\n\n        private void InitializeComponent()\n        {\n            this.CellOne = new System.Windows.Forms.MaskedTextBox();\n            this.CellFour = new System.Windows.Forms.MaskedTextBox();\n            this.CellFive = new System.Windows.Forms.MaskedTextBox();\n            this.CellSix = new System.Windows.Forms.MaskedTextBox();\n            this.CellTwo = new System.Windows.Forms.MaskedTextBox();\n            this.CellThree = new System.Windows.Forms.MaskedTextBox();\n            this.CellSeven = new System.Windows.Forms.MaskedTextBox();\n            this.CellEight = new System.Windows.Forms.MaskedTextBox();\n            this.CellNine = new System.Windows.Forms.MaskedTextBox();\n            this.SuspendLayout();\n            \/\/ \n            \/\/ CellOne\n            \/\/ \n            this.CellOne.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\n            this.CellOne.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.CellOne.Location = new System.Drawing.Point(8, 8);\n            this.CellOne.Mask = \"0\";\n            this.CellOne.Name = \"CellOne\";\n            this.CellOne.PromptChar = ' ';\n            this.CellOne.Size = new System.Drawing.Size(26, 26);\n            this.CellOne.TabIndex = 0;\n            this.CellOne.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;\n\n            \/\/CellTwo through CellNine omitted for brevity\n\n        \/\/ \n        \/\/ CellBlock\n        \/\/ \n        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\n        this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\n        this.Controls.Add(this.CellNine);\n        this.Controls.Add(this.CellEight);\n        this.Controls.Add(this.CellSeven);\n        this.Controls.Add(this.CellThree);\n        this.Controls.Add(this.CellTwo);\n        this.Controls.Add(this.CellSix);\n        this.Controls.Add(this.CellFive);\n        this.Controls.Add(this.CellFour);\n        this.Controls.Add(this.CellOne);\n        this.Name = \"CellBlock\";\n        this.Size = new System.Drawing.Size(107, 107);\n        this.ResumeLayout(false);\n        this.PerformLayout();\n\n    }\n\n    private System.Windows.Forms.MaskedTextBox CellOne;\n    private System.Windows.Forms.MaskedTextBox CellFour;\n    private System.Windows.Forms.MaskedTextBox CellFive;\n    private System.Windows.Forms.MaskedTextBox CellSix;\n    private System.Windows.Forms.MaskedTextBox CellTwo;\n    private System.Windows.Forms.MaskedTextBox CellThree;\n    private System.Windows.Forms.MaskedTextBox CellSeven;\n    private System.Windows.Forms.MaskedTextBox CellEight;\n    private System.Windows.Forms.MaskedTextBox CellNine;\n}\n<\/code><\/pre>\n<p>}<\/p>\n<p>These files are in the same solution as <code>Sudoku.cs<\/code>, the main file. I simply added a user control to the solution through the project menu. This is the code in <code>Sudoku.Designer.cs<\/code>, once again, automatically generated by Visual Studio.<\/p>\n<pre><code>namespace Sudoku\n{\n    partial class Sudoku\n    {\n\n        private System.ComponentModel.IContainer components = null;\n\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing &amp;&amp; (components != null))\n            {\n                components.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n\n        private void InitializeComponent()\n        {\n            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Sudoku));\n            this.cellBlock1 = new Sudoku.CellBlock();\n            this.cellBlock2 = new Sudoku.CellBlock();\n            this.cellBlock3 = new Sudoku.CellBlock();\n            this.cellBlock4 = new Sudoku.CellBlock();\n            this.cellBlock5 = new Sudoku.CellBlock();\n            this.cellBlock6 = new Sudoku.CellBlock();\n            this.cellBlock7 = new Sudoku.CellBlock();\n            this.cellBlock8 = new Sudoku.CellBlock();\n            this.cellBlock9 = new Sudoku.CellBlock(); \/\/errors occur at these lines\n\n}\n\n\n        private CellBlock cellBlock1;\n        private CellBlock cellBlock2;\n        private CellBlock cellBlock3;\n        private CellBlock cellBlock4;\n        private CellBlock cellBlock5;\n        private CellBlock cellBlock6;\n        private CellBlock cellBlock7;\n        private CellBlock cellBlock8;\n        private CellBlock cellBlock9;\n\n    }\n}\n<\/code><\/pre>\n<p>I think that&#8217;s all correct, even though I&#8217;m omitting some of the automatically-generated code for the sake of brevity. When I build the solution, I get 9 errors like this: The type name &#8216;CellBlock&#8217; does not exist in the type &#8216;Sudoku.Sudoku&#8217;<\/p>\n<p>referencing the lines that read: <code>this.cellBlock1 = new Sudoku.CellBlock();<\/code>, etc. I thought that maybe I need to add a reference to <code>CellBlock, even though it's within the same solution, but when I click<\/code>Add Reference`, nothing is listed under project.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I created a simple Sudoku application, where each 3&#215;3 squares is a user control, with this skeleton code in CellBlock.Designer.cs and nothing but the automatically generated code in CellBlock.cs: namespace Sudoku { partial class CellBlock { private System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components.Dispose(); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4308","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4308"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4308\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}