title: Can't figure out why variable is unassigned or undeclared
body: <p>Visual Studio just threw this warning screen at me:</p>
  
  <p><img src="https://i.stack.imgur.com/kdWBV.png" alt="enter image description here"></p>
  
  <p>I know what it means but I can't figure out how to fix it. When I look through the "InitializeComponent()" method everything seems fine. It's a custom control consisting of a Table and a lot of text boxes. The program can still be compiled fine without errors. I have looked around on the internet to find a solution but none of the examples really fit mine and whatever I tried for "hotfixes" didn't really solve anything.</p>
  
  <p>Variables:</p>
  
  <pre><code>private BiologiskFamiliePanel sdBiologiskFamiliePanel;
  </code></pre>
  
  <p>InitializeComponent:</p>
  
  <pre><code>...
  this.sdBiologiskFamiliePanel = new Smart_Journal.Controls.BiologiskFamiliePanel();
  ...
  this.sdGroupBox.Controls.Add(this.sdBiologiskFamiliePanel); // Where the Error Message put me
  ...
  this.sdBiologiskFamiliePanel.Location = new System.Drawing.Point(6, 338);
  this.sdBiologiskFamiliePanel.Name = "sdBiologiskFamiliePanel";
  this.sdBiologiskFamiliePanel.Size = new System.Drawing.Size(329, 272);
  this.sdBiologiskFamiliePanel.TabIndex = 2;
  </code></pre>
  
  <p>Can you spot something that I have obviously missed?</p>
  
  <p>EDIT:</p>
  
  <p>StamDataPanel.Designer.cs</p>
  
  <pre><code>using Smart_Journal.Controls;
  
  namespace Smart_Journal.Controls
  {
      partial class StamDataPanel
      {
          /// &lt;summary&gt; 
          /// Required designer variable.
          /// &lt;/summary&gt;
          private System.ComponentModel.IContainer components = null;
  
          /// &lt;summary&gt; 
          /// Clean up any resources being used.
          /// &lt;/summary&gt;
          /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
          protected override void Dispose(bool disposing)
          {
              if (disposing &amp;&amp; (components != null))
              {
                  components.Dispose();
              }
              base.Dispose(disposing);
          }
  
          #region Component Designer generated code
  
          /// &lt;summary&gt; 
          /// Required method for Designer support - do not modify 
          /// the contents of this method with the code editor.
          /// &lt;/summary&gt;
          private void InitializeComponent()
          {
              this.sdGroupBox = new System.Windows.Forms.GroupBox();
              this.sdPlejeFamiliePanel = new Smart_Journal.Controls.PlejeFamiliePanel();
              this.sdBiologiskFamiliePanel = new Smart_Journal.Controls.BiologiskFamiliePanel();
              this.sdPlejeBarnPanel = new Smart_Journal.Controls.PlejeBarnPanel();
              this.sdMenuStrip = new System.Windows.Forms.MenuStrip();
              this.filerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdGemItem = new System.Windows.Forms.ToolStripMenuItem();
              this.visToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdVisPlejeboernItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdVisBFamilieItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdVisKursusListeItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdVisVederlagItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdVisAlleItem = new System.Windows.Forms.ToolStripMenuItem();
              this.sdPlejeFamilieKursusListePanel = new Smart_Journal.Controls.PlejeFamilieKursusListePanel();
              this.sdPlejeFamilieAndreBornPanel = new Smart_Journal.Controls.PlejeFamilieAndreBornPanel();
              this.sdPlejeFamilieVedlagPanel = new Smart_Journal.Controls.PlejeFamilieVedlagPanel();
              this.sdGroupBox.SuspendLayout();
              this.sdMenuStrip.SuspendLayout();
              this.SuspendLayout();
              // 
              // sdGroupBox
              // 
              this.sdGroupBox.Controls.Add(this.sdPlejeFamiliePanel);
              this.sdGroupBox.Controls.Add(this.sdBiologiskFamiliePanel);
              this.sdGroupBox.Controls.Add(this.sdPlejeBarnPanel);
              this.sdGroupBox.Location = new System.Drawing.Point(3, 27);
              this.sdGroupBox.Name = "sdGroupBox";
              this.sdGroupBox.Size = new System.Drawing.Size(644, 610);
              this.sdGroupBox.TabIndex = 0;
              this.sdGroupBox.TabStop = false;
              this.sdGroupBox.Text = "Stamdata";
              // 
              // sdPlejeFamiliePanel
              // 
              this.sdPlejeFamiliePanel.AutoSize = true;
              this.sdPlejeFamiliePanel.Location = new System.Drawing.Point(337, 19);
              this.sdPlejeFamiliePanel.Name = "sdPlejeFamiliePanel";
              this.sdPlejeFamiliePanel.RightToLeft = System.Windows.Forms.RightToLeft.No;
              this.sdPlejeFamiliePanel.Size = new System.Drawing.Size(296, 415);
              this.sdPlejeFamiliePanel.TabIndex = 3;
              // 
              // sdBiologiskFamiliePanel
              // 
              this.sdBiologiskFamiliePanel.Location = new System.Drawing.Point(6, 338);
              this.sdBiologiskFamiliePanel.Name = "sdBiologiskFamiliePanel";
              this.sdBiologiskFamiliePanel.Size = new System.Drawing.Size(329, 272);
              this.sdBiologiskFamiliePanel.TabIndex = 2;
              // 
              // sdPlejeBarnPanel
              // 
              this.sdPlejeBarnPanel.AutoSize = true;
              this.sdPlejeBarnPanel.Bemaerkninger = null;
              this.sdPlejeBarnPanel.Location = new System.Drawing.Point(2, 19);
              this.sdPlejeBarnPanel.Name = "sdPlejeBarnPanel";
              this.sdPlejeBarnPanel.Size = new System.Drawing.Size(329, 313);
              this.sdPlejeBarnPanel.TabIndex = 0;
              this.sdPlejeBarnPanel.TideligereForanstaltninger = null;
              // 
              // sdMenuStrip
              // 
              this.sdMenuStrip.AllowMerge = false;
              this.sdMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
              this.filerToolStripMenuItem,
              this.visToolStripMenuItem});
              this.sdMenuStrip.Location = new System.Drawing.Point(0, 0);
              this.sdMenuStrip.Name = "sdMenuStrip";
              this.sdMenuStrip.Size = new System.Drawing.Size(918, 24);
              this.sdMenuStrip.TabIndex = 3;
              this.sdMenuStrip.Text = "menuStrip1";
              // 
              // filerToolStripMenuItem
              // 
              this.filerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
              this.sdGemItem});
              this.filerToolStripMenuItem.Name = "filerToolStripMenuItem";
              this.filerToolStripMenuItem.ShortcutKeyDisplayString = "";
              this.filerToolStripMenuItem.Size = new System.Drawing.Size(41, 20);
              this.filerToolStripMenuItem.Text = "Filer";
              // 
              // sdGemItem
              // 
              this.sdGemItem.Name = "sdGemItem";
              this.sdGemItem.ShortcutKeyDisplayString = "Ctrl + S";
              this.sdGemItem.Size = new System.Drawing.Size(203, 22);
              this.sdGemItem.Text = "Gem Ændringer";
              this.sdGemItem.Click += new System.EventHandler(this.sdGemItem_Click);
              // 
              // visToolStripMenuItem
              // 
              this.visToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
              this.sdVisPlejeboernItem,
              this.sdVisBFamilieItem,
              this.sdVisKursusListeItem,
              this.sdVisVederlagItem,
              this.sdVisAlleItem});
              this.visToolStripMenuItem.Name = "visToolStripMenuItem";
              this.visToolStripMenuItem.Size = new System.Drawing.Size(34, 20);
              this.visToolStripMenuItem.Text = "Vis";
              // 
              // sdVisPlejeboernItem
              // 
              this.sdVisPlejeboernItem.Name = "sdVisPlejeboernItem";
              this.sdVisPlejeboernItem.ShortcutKeyDisplayString = "";
              this.sdVisPlejeboernItem.Size = new System.Drawing.Size(163, 22);
              this.sdVisPlejeboernItem.Text = "Andre Plejebørn";
              this.sdVisPlejeboernItem.Click += new System.EventHandler(this.sdVisPlejeboernItem_Click);
              // 
              // sdVisBFamilieItem
              // 
              this.sdVisBFamilieItem.Name = "sdVisBFamilieItem";
              this.sdVisBFamilieItem.Size = new System.Drawing.Size(163, 22);
              this.sdVisBFamilieItem.Text = "Biologisk Familie";
              this.sdVisBFamilieItem.Click += new System.EventHandler(this.sdVisBFamilieItem_Click);
              // 
              // sdVisKursusListeItem
              // 
              this.sdVisKursusListeItem.Name = "sdVisKursusListeItem";
              this.sdVisKursusListeItem.Size = new System.Drawing.Size(163, 22);
              this.sdVisKursusListeItem.Text = "Kursus Liste";
              this.sdVisKursusListeItem.Click += new System.EventHandler(this.sdVisKursusListeItem_Click);
              // 
              // sdVisVederlagItem
              // 
              this.sdVisVederlagItem.Name = "sdVisVederlagItem";
              this.sdVisVederlagItem.Size = new System.Drawing.Size(163, 22);
              this.sdVisVederlagItem.Text = "Vederlag";
              this.sdVisVederlagItem.Click += new System.EventHandler(this.sdVisVederlagItem_Click);
              // 
              // sdVisAlleItem
              // 
              this.sdVisAlleItem.Name = "sdVisAlleItem";
              this.sdVisAlleItem.Size = new System.Drawing.Size(163, 22);
              this.sdVisAlleItem.Text = "Vis Alle";
              this.sdVisAlleItem.Click += new System.EventHandler(this.sdVisAlleItem_Click);
              // 
              // sdPlejeFamilieKursusListePanel
              // 
              this.sdPlejeFamilieKursusListePanel.Location = new System.Drawing.Point(652, 27);
              this.sdPlejeFamilieKursusListePanel.Name = "sdPlejeFamilieKursusListePanel";
              this.sdPlejeFamilieKursusListePanel.Size = new System.Drawing.Size(262, 195);
              this.sdPlejeFamilieKursusListePanel.TabIndex = 5;
              // 
              // sdPlejeFamilieAndreBornPanel
              // 
              this.sdPlejeFamilieAndreBornPanel.Location = new System.Drawing.Point(653, 387);
              this.sdPlejeFamilieAndreBornPanel.Name = "sdPlejeFamilieAndreBornPanel";
              this.sdPlejeFamilieAndreBornPanel.Size = new System.Drawing.Size(262, 210);
              this.sdPlejeFamilieAndreBornPanel.TabIndex = 4;
              // 
              // sdPlejeFamilieVedlagPanel
              // 
              this.sdPlejeFamilieVedlagPanel.Location = new System.Drawing.Point(652, 228);
              this.sdPlejeFamilieVedlagPanel.Name = "sdPlejeFamilieVedlagPanel";
              this.sdPlejeFamilieVedlagPanel.Size = new System.Drawing.Size(262, 156);
              this.sdPlejeFamilieVedlagPanel.TabIndex = 2;
              // 
              // StamDataPanel
              // 
              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
              this.AutoSize = true;
              this.Controls.Add(this.sdPlejeFamilieKursusListePanel);
              this.Controls.Add(this.sdPlejeFamilieAndreBornPanel);
              this.Controls.Add(this.sdPlejeFamilieVedlagPanel);
              this.Controls.Add(this.sdGroupBox);
              this.Controls.Add(this.sdMenuStrip);
              this.Name = "StamDataPanel";
              this.Size = new System.Drawing.Size(918, 640);
              this.sdGroupBox.ResumeLayout(false);
              this.sdGroupBox.PerformLayout();
              this.sdMenuStrip.ResumeLayout(false);
              this.sdMenuStrip.PerformLayout();
              this.ResumeLayout(false);
              this.PerformLayout();
  
          }
  
          #endregion
  
          private System.Windows.Forms.GroupBox sdGroupBox;
          private BiologiskFamiliePanel sdBiologiskFamiliePanel;
          private PlejeBarnPanel sdPlejeBarnPanel;
          private PlejeFamilieVedlagPanel sdPlejeFamilieVedlagPanel;
          private System.Windows.Forms.MenuStrip sdMenuStrip;
          private System.Windows.Forms.ToolStripMenuItem visToolStripMenuItem;
          private System.Windows.Forms.ToolStripMenuItem sdVisPlejeboernItem;
          private System.Windows.Forms.ToolStripMenuItem sdVisBFamilieItem;
          private System.Windows.Forms.ToolStripMenuItem sdVisKursusListeItem;
          private System.Windows.Forms.ToolStripMenuItem sdVisVederlagItem;
          private System.Windows.Forms.ToolStripMenuItem sdVisAlleItem;
          private System.Windows.Forms.ToolStripMenuItem filerToolStripMenuItem;
          private System.Windows.Forms.ToolStripMenuItem sdGemItem;
          private PlejeFamiliePanel sdPlejeFamiliePanel;
          private Controls.PlejeFamilieAndreBornPanel sdPlejeFamilieAndreBornPanel;
          private PlejeFamilieKursusListePanel sdPlejeFamilieKursusListePanel;
      }
  }
  </code></pre>
  
  <p>StamDataPanel.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Drawing;
  using System.Data;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using Smart_Journal.Controls;
  using Smart_Journal.Familie;
  
  namespace Smart_Journal.Controls
  {
      public partial class StamDataPanel : UserControl
      {
          public StamDataPanel(PlejeBarn p)
          {
              InitializeComponent();
  
          }
  
          public StamDataPanel()
          {
              InitializeComponent();
          }
  
          private void sdGemItem_Click(object sender, EventArgs e)
          {
              Utility.GemStamdata(this);
          }
  
          private void sdVisPlejeboernItem_Click(object sender, EventArgs e)
          {
              //sdPlejeFamilieAndreBornPanel
          }
  
          private void sdVisBFamilieItem_Click(object sender, EventArgs e)
          {
              //sdBiologiskFamiliePanel.EnableFields(true);
          }
  
          private void sdVisKursusListeItem_Click(object sender, EventArgs e)
          {
  
          }
  
          private void sdVisVederlagItem_Click(object sender, EventArgs e)
          {
  
          }
  
          private void sdVisAlleItem_Click(object sender, EventArgs e)
          {
  
          }
  
          public PlejeBarnPanel PlejeBarnPanelObjekt()
          {
              return sdPlejeBarnPanel;
          }
  
          public PlejeFamiliePanel PlejeFamiliePanelObjekt()
          {
              return sdPlejeFamiliePanel;
          }
  
          public PlejeFamilieVedlagPanel PlejeFamilieVedlagPanelObjekt()
          {
              return sdPlejeFamilieVedlagPanel;
          }
  
          public PlejeFamilieKursusListePanel PlejeFamilieKursusListePanelObjekt()
          {
              return sdPlejeFamilieKursusListePanel;
          }
  
          public PlejeFamilieAndreBornPanel PlejeFamilieAndreBornPanelObjekt()
          {
              return sdPlejeFamilieAndreBornPanel;
          }
  
          public BiologiskFamiliePanel BiologiskFamiliePanelObjekt()
          {
              return sdBiologiskFamiliePanel;
          }
      }
  }
  </code></pre>