Object must implement IConvertible. exception in VS designer

Hello,

I create a new control based on ButtonEdit control:


public partial class MySearchTextbox : ButtonEdit
    {
        public MySearchTextbox()
        {
            InitializeComponent();


            this.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
            this.Margin = new System.Windows.Forms.Padding(3, 3, 3, 6);
            this.UseVisualStyle = true;
            this.ButtonStyle = Syncfusion.Windows.Forms.ButtonAppearance.Metro;


        }


        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }


        protected override void OnCreateControl()
        {
            base.OnCreateControl();


            TextBoxExt txtSearch;
            ButtonEditChildButton btnClear;
            ButtonEditChildButton btnPrev;
            ButtonEditChildButton btnNext;


            txtSearch = new TextBoxExt();
            btnClear = new ButtonEditChildButton();
            btnPrev = new ButtonEditChildButton();
            btnNext = new ButtonEditChildButton();


            //Embedding text in TextBox
            this.TextBox = txtSearch;
            this.Controls.Add(txtSearch);


            //Aligning the child button
            btnClear.ButtonAlign = ButtonAlignment.Right;
            btnPrev.ButtonAlign = ButtonAlignment.Right;
            btnNext.ButtonAlign = ButtonAlignment.Right;


            //Setting text for child buttons
            btnClear.Text = "X";
            btnPrev.Text = "<";
            btnNext.Text = ">";


            btnClear.Size = new(20, 20);
            btnPrev.Size = new(20, 20);
            btnNext.Size = new(20, 20);


            //Adding child buttons
            this.Buttons.Add(btnClear);
            this.Buttons.Add(btnPrev);
            this.Buttons.Add(btnNext);
        }
    }

I rebuild the above code, I place the MySearchTextbox on a form. This works well.

Now, when I change anything in the above code and rebuild the project, I cannot open the previous form again in designer:


Can you help me please how can I avoid this exception?

Thank you!

BR, SZL


3 Replies

GT Gokul Thanudhas Syncfusion Team August 29, 2022 07:44 AM UTC

Hi SZL,


Sorry for the delay in getting back to you.

We are unable to reproduce the exact issue of yours. When changing the properties and rebuilding the project, the designer becomes empty. Please refer the video and the sample from the attachment.


Could you please share which property you have changed and the sample to replicate the issue?


Regards,

Gokul T


Attachment: ButtonEdit_cbc5bfe8.zip


SZ SZL replied to Gokul Thanudhas September 2, 2022 07:11 AM UTC

Hello,

In my case after the second rebuild was wrong. I think there are some problem with this control but its not to easy detect the reason. I try add the button from code instead of designer. In this case at runtime the top of my form starts vibrating. I debug and seems it depends on multiple thing (the Margin settings, when I set the textbox placeholder the vibration appear). 

For this reason I created my own usercontrol for my requirements. 

Unfortunatelly currently I have no extra time to deep-debug this behavior on this control. Probably at later time.

From my side we can close this topic.

Thank you for help!

BR, SZL





BA BagavathiPerumal Apranandham Syncfusion Team September 5, 2022 11:06 AM UTC

Hi SZL,


Thanks for the update. Please let us know if you have any other queries. We will be glad to assist you.



Regards,

Bagavathi Perumal A



Loader.
Up arrow icon