We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

TargetInvocationException for ButtonEdit control.

Hi,

After i migrate my code from Syncfusion 4.3 to 5.1, I got the following exception when i try to run my application. Please help me to fix the problem.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: BorderStyle value must be None
at Syncfusion.Windows.Forms.Tools.ButtonEdit.HandleEditBorderStyleChanged(Object sender, EventArgs e)
at System.Windows.Forms.TextBoxBase.OnBorderStyleChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.set_BorderStyle(BorderStyle value)

Thanks,
-Ravi.

5 Replies

PJ Poly J Syncfusion Team May 21, 2007 02:20 PM UTC

Hi Ravi,

Thanks for your interest in Syncfusion products.
I am not able to reproduce the issue in our end. Could you please send me the CS file which using ButtonEdit Control in your application.

Best Regards,
Poly





RA Ravi May 21, 2007 04:29 PM UTC

Hi Poly,

In the InitializeComponent() method, iam getting the exception at "this.TextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;" line.

Thanks,
Ravi.


PJ Poly J Syncfusion Team May 22, 2007 10:31 AM UTC

Hi Ravi,

Thanks for the update.
In 4.3 version Button Edit Embedded text box uses windows form textbox control . In the Essential Studio latest version the Embedded textBox is changed to Syncfusion TextBoxExt control. Please change the BorderStyle to None and let me know if it is solve the issue.

Best regards,
Poly




RA Ravi May 22, 2007 01:57 PM UTC

Thanks Poly, it works. Is TextBoxExt control internally uses any border style. Do i need to add any extra code to make things to work. Because by default values in the Button edit control are not populating in v5.1. Following is the code which use to work perfectly with v4.3.

this.lookupBT = new Syncfusion.Windows.Forms.Tools.ButtonEditChildButton();
//
// lookupBT
//
this.lookupBT.ButtonAlign = Syncfusion.Windows.Forms.Tools.ButtonAlignment.Right;
this.lookupBT.ButtonEditParent = this;
this.lookupBT.ButtonType = Syncfusion.Windows.Forms.Tools.ButtonTypes.Browse;
this.lookupBT.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lookupBT.Location = new System.Drawing.Point(100, 0);
this.lookupBT.Name = "lookupBT";
this.lookupBT.PreferredWidth = 24;
this.lookupBT.Size = new System.Drawing.Size(16, 22);
this.lookupBT.TabIndex = 1;
this.lookupBT.TabStop = true;
//
// customerLF
//
this.Buttons.Add(this.lookupBT);
this.Controls.Add(this.lookupBT);
this.Location = new System.Drawing.Point(120, 40);
this.Name = "customerLF";
this.ParentContainer = null;
this.SelectionLength = 0;
this.SelectionStart = 0;
this.ShowTextBox = true;
this.Size = new System.Drawing.Size(216, 22);
this.TabIndex = 1;
this.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.TextBox.AutoSize = false;
this.TextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; //Modified as you suggested.
this.TextBox.Location = new System.Drawing.Point(1, 2);
this.TextBox.Name = "";
this.TextBox.Size = new System.Drawing.Size(198, 18);
this.TextBox.TabIndex = 0;


Regards,
Ravi.


MU Murugan Syncfusion Team May 23, 2007 12:08 AM UTC

Hi Ravi,

ButtonEdit.TextBoxExt control is not using any BorderStyle internally. When ButtonEdit control is used, it is default to set TextBoxExt.BorderStyle = BordeStyle.None. Could you please provide us more details about the issue?

I have customized the ButtonEdit control, even I could see the default values in the TextBoxExt of the ButtonEdit control. Could you please modify the sample below to reproduce the issue as you mentioned?

[Sample]
http://websamples.syncfusion.com/samples/Tools.Windows/F61161/Main.htm

Thanks for your patience.

Regards,
Murugan P.S

Loader.
Live Chat Icon For mobile
Up arrow icon