简体   繁体   中英

Winform Designer generated name bug with custom control

Using Visual Studio 2019, I get a bug with a custom control, the following Numeric Up Down:

namespace usbACQ_ProdConf
{
    public partial class usbACQ_ProdConf : Form
    {
        public class MyNumericUpDown : NumericUpDown
        {
            protected override void UpdateEditText()
            {
                Text = ((uint)Value).ToString("X4");
            }

        }
    }
}

Every time I edit the design, an error gets generated in the designer because it adds a parasite .usbACQ_ProdConf :

What is generated:

private void InitializeComponent()
{
        this.nUD_usbPID = new usbACQ_ProdConf.usbACQ_ProdConf.MyNumericUpDown();

What I have to edit every time:

private void InitializeComponent()
{
        this.nUD_usbPID = new usbACQ_ProdConf.MyNumericUpDown();

Does anyone know how to fix this annoying bug?

Thanks to @Jimi,
I renamed the namespace and put the custom control class outside of the other class. It works now and the name is just MyNumericUpDown

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM