Why does my Designer Generated Code (InitializeComponent()) Not Generate an Object Instantiation Line For my Custom Control?

Enviroment details: DOTNET 4.8. Visual studio 2022. Designer interface (idk if that’s what it’s actually called)

I’ve created a Custom form called WeatherBox which inherits from another custom form MultiSelectComboBox. After building the project I can select the WeatherBox item from the toolbox window and create one within the designer view. However, when I build the project, after adding the WeatherBox to the form, it throws an error because the designer generated code didn’t include a line instantiating the custom class (as it normally does, and it does with MultiSelectComboBox which WeatherBox inherits from). Obviously, I can manually fix the error by implimenting the innstantiation myself, but that would be a pain to do every time I wanted to create a new WeatherBox.

Here is the weather box class:

using [redacted].Util;
using [redacted].GUI.CustomizedControls;
using [redacted].GUI.CustomizedControls.MultiSelectComboBoxControl;
using System;
using System.Windows.Forms;

namespace [redacted].GUI.CustomizedControls.MultiSelectComboBoxControl.CustomMultiSelectComboBoxes
{
    public class WeatherBox : MultiSelectComboBox
    {
        WeatherBox() : base()
        {
            ListItemSelected += new System.EventHandler(WeatherYearBox_ListItemSelected);
        }

        private static void WeatherYearBox_ListItemSelected(object sender, EventArgs e)
        {
            try
            {
                CheckedListView CLV = (CheckedListView)sender;
                MultiSelectComboBox CMB = (MultiSelectComboBox)CLV.Tag;
                if (CMB.List.FocusedItem != null && CMB.List.FocusedItem.Text != "")
                {
                    CMB.close();
                    CMB.Tag = CMB.List.FocusedItem.Tag;
                    CMB.Items.Insert(0, CMB.List.FocusedItem.Text);
                    CMB.SelectedIndex = 0;
                }
                else
                    CMB.Tag = null;
            }
            catch (Exception ex)
            {
                Logger.logInfo(ex);
            }
        }
    }
}

The MultiSelectComboBoxControl is quite a large class, So I’ve just copied the instantiation (I’m not sure how relevant that is to the problem):

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using [redacted].Util; 
using System.Text.RegularExpressions;
using System.Drawing;

namespace SERVM.MCFRED.GUI.CustomizedControls.MultiSelectComboBoxControl
{
    public class MultiSelectComboBox : ComboBox
    {
        public MultiSelectComboBox()
            : base()
            {
                contents.Owner = this;
                contents.searchbox.Tag = this;
                contents.searchBoxPic.Tag = true;
                popup = new Popup(contents);
                popup.Resizable = true;
                popup.Height = 500;
                popup.Tag = this;
                popup.LostFocus += new EventHandler(popup_LostFocus);
                popup.VisibleChanged += new EventHandler(popup_VisibleChanged);
                contents.resizeBox.MouseDown += new MouseEventHandler(pictureBox1_MouseDown);
                contents.resizeBox.MouseUp += new MouseEventHandler(pictureBox1_MouseUp);
                contents.resizeBox.MouseMove += new MouseEventHandler(pictureBox1_MouseMove);


                if (!isMultiSelectEnable)
                {

                }
                contents.checkedListView.Tag = popup;

                List = contents.checkedListView;
                List.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                List.Click += new EventHandler(delegate { });


                SuspendLayout();
                Name = "MultiSelectComboBox";
                Size = new System.Drawing.Size(237, 23);
                DropDownHeight = 1;
                DropDownStyle = ComboBoxStyle.DropDownList;
                Click += new EventHandler(SortableDropDown_Click);
                MouseHover += new EventHandler(MultiSelectComboBox_MouseHover);
                MouseWheel += new MouseEventHandler(MultiSelectComboBox_MouseWheel);
                Layout += new LayoutEventHandler(MultiSelectComboBox_Layout);
                ResumeLayout(false);
            }
    }
}

Most everything here is legacy code, please forgive the mess.

And then As for Designer generated code:

It generates the following lines for both custom controls outside of the InitializeComponent():

private CustomizedControls.MultiSelectComboBoxControl.CustomMultiSelectComboBoxes.WeatherBox weatherBox1;
private CustomizedControls.MultiSelectComboBoxControl.MultiSelectComboBox multiSelectComboBox1;

But, inside the InitializeComponent(), at the top, it generates:

this.multiSelectComboBox1 = new [redacted].GUI.CustomizedControls.MultiSelectComboBoxControl.MultiSelectComboBox();

But does not generate, what I assume it should:

this._weatherYearBox = new [redacted].GUI.CustomizedControls.MultiSelectComboBoxControl.CustomMultiSelectComboBoxes.WeatherBox();

Thanks for taking a look at my issue!

I’ve tried building, re-building and cleaning the solution in combination with restarting Visual studio, as well as deleting/adding that : base() signature thing after the constructor for WeatherBox (I copied it because I saw it was present in the MultiSelectComboBox class which was working- but the presence or absence of “: base()” after the constructor doesn’t seem to make a difference”) – I should probably research what that means. Will do after finishing this post.

None of these solutions have helped. The designer code generator remains broken when I try to implement a WeatherBox.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật