Readonly Controls Collection warning

Topics related to the Krypton Toolkit.

Moderators: Phil Wright, Chris Porter

Readonly Controls Collection warning

Postby mjenkinson05 » Tue Apr 10, 2012 10:36 pm

Since upgrading to 4.4.0 I've received 4 warnings stating "Readonly Controls Collection"

Ive posted one of the 4 sections below.. theyre all roughlt the same other than names and sizes:

Code: Select all
'grpDescription
'
Me.grpDescription.Controls.Add(Me.grpDescription.Panel)
Me.grpDescription.Location = New System.Drawing.Point(22, 497)
Me.grpDescription.Name = "grpDescription"
Me.grpDescription.Size = New System.Drawing.Size(951, 195)
Me.grpDescription.TabIndex = 77
Me.grpDescription.Values.Heading = "Description of Work"


The line its complaining about is the 'Controls.Add' line.

Ive tried registering the design.dll with gacutil and that hasnt solved the problem.

Any help would be appreciated.
mjenkinson05
 
Posts: 12
Joined: Tue Nov 10, 2009 9:38 pm

Re: Readonly Controls Collection warning

Postby bkone » Thu Apr 12, 2012 4:25 pm

The same applies to me.

After upgrading to version 4.4.0 from 4.3.2 I cannot open any KryptonControl in Designer anymore. The warnings tab shows the cited message "Readonly Controls Collection warning".

Any help is very much appreciated.

Edit: Just to clarify: I am no longer able to work on my "project" because I neither can edit any Krypton controls properties nor add new Krypton controls to my form... :(
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm

Re: Readonly Controls Collection warning

Postby bkone » Mon Apr 16, 2012 11:29 pm

Hello again,

almost a week has passed since my last post and there has been no reaction at all.

Is this forum read by any staff of Component Factory? Or is this just a case of "users help users"?
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm

Re: Readonly Controls Collection warning

Postby Pau » Tue Apr 17, 2012 7:24 am

I had the same issue.

I just deleted that line, and the designer and everything worked again.
Pau
 
Posts: 10
Joined: Thu Dec 23, 2010 12:01 am

Re: Readonly Controls Collection warning

Postby bkone » Tue Apr 17, 2012 5:50 pm

Hi,

sorry, which line? This one:
Code: Select all
Me.grpDescription.Controls.Add(Me.grpDescription.Panel)


In my case, I have several Controls in several Groupboxes, where for each Groupbox the designer added a line like
Code: Select all
this.cvsAuthenticationGroupbox.Controls.Add(this.cvsAuthenticationGroupbox.Panel);

Removing those line results in losing the controls being contained in the groupbox...
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm

Re: Readonly Controls Collection warning

Postby Pau » Wed Apr 18, 2012 5:11 am

Yes, I deleted that line (thoght it was a HeaderPanel control...).

In case of doublt, you can always delete the controls, and drop them again into your form... I'm pretty sure it will work...
Pau
 
Posts: 10
Joined: Thu Dec 23, 2010 12:01 am

Re: Readonly Controls Collection warning

Postby bkone » Wed Apr 18, 2012 6:41 pm

Hi again,

I found the problem: in version 4.3.2 the panel of the groupbox was added directly by the designer using
Code: Select all
this.cvsAuthenticationGroupbox.Controls.Add(this.cvsAuthenticationGroupbox.Panel);


It seems that this is no longer possible in version 4.4.

The solution seems simple: You have to remove the line shown above and add the controls to the Panel by
Code: Select all
this.cvsAuthenticationGroupbox.Panel.Controls.Add(this.kryptonLabel1);
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm

Re: Readonly Controls Collection warning

Postby mjenkinson05 » Wed Apr 18, 2012 9:29 pm

I dont understand what I need to do to get this working??
mjenkinson05
 
Posts: 12
Joined: Tue Nov 10, 2009 9:38 pm

Re: Readonly Controls Collection warning

Postby bkone » Wed Apr 18, 2012 9:54 pm

Open the .designer.cs file of your form.

Look for any occurence of
Code: Select all
...Controls.Add(....Panel);


Replace by
Code: Select all
....Panel.Controls.Add(...);


In my application the following worked:
BEFORE:
Code: Select all
            //
            // cvsClientGroupbox
            //
            this.cvsClientGroupbox.Controls.Add(this.cvsClientGroupbox.Panel);
            this.cvsClientGroupbox.Location = new System.Drawing.Point(6, 118);
            this.cvsClientGroupbox.Name = "cvsClientGroupbox";
            this.cvsClientGroupbox.Size = new System.Drawing.Size(595, 82);
            this.cvsClientGroupbox.TabIndex = 26;
            this.cvsClientGroupbox.Values.Heading = "Misc";


AFTER:
Code: Select all
            //
            // cvsClientGroupbox
            //
            this.cvsClientGroupbox.Location = new System.Drawing.Point(6, 118);
            this.cvsClientGroupbox.Name = "cvsClientGroupbox";
            //
            // cvsClientGroupbox.Panel
            //
            this.cvsClientGroupbox.Panel.Controls.Add(this.cvsBinLabel);
            this.cvsClientGroupbox.Panel.Controls.Add(this.cvsBinBox);
            this.cvsClientGroupbox.Panel.Controls.Add(this.cvsWebLabel);
            this.cvsClientGroupbox.Panel.Controls.Add(this.cvsWebBox);
            this.cvsClientGroupbox.Size = new System.Drawing.Size(595, 84);
            this.cvsClientGroupbox.TabIndex = 26;
            this.cvsClientGroupbox.Values.Heading = "Misc";


Basicly you have to remove the lines that add the Panel to the Controls-Container and replace them with .Panel.Controls.Add(<your control>).

Hope you understand what I am trying to say.
bkone
 
Posts: 8
Joined: Thu Apr 12, 2012 4:21 pm

Re: Readonly Controls Collection warning

Postby mjenkinson05 » Thu May 31, 2012 7:23 pm

Im pulling my hair out with this one. I Just cannot get it to work.

Your instructions above are helpful, but im using VB not C so im a little lost.
mjenkinson05
 
Posts: 12
Joined: Tue Nov 10, 2009 9:38 pm

Re: Readonly Controls Collection warning

Postby Jase555 » Sun Jun 03, 2012 9:33 pm

Deleteing these lines may work for existing code.

However the work around does not allow the designer to work for adding\creating a layout in the layout designer in VS2010. If you manually add a KryptonWorkspace in code then the designer will render it properly. Dragging onto the designer produces an error about System.NotSupportedException: Readonly controls collection at..... KryptonReadOnlyControls.Add(

To be clear. It is the adding of the component that throws the exception amking very labour intensive to build a new GUI.

Any fixes. I have the full source so can fix it locally if someone will point me in the right direction.

cheers
Jason
Jase555
 
Posts: 39
Joined: Sat Jun 09, 2007 10:43 pm
Location: Midlands - UK


Return to Krypton Toolkit

Who is online

Users browsing this forum: No registered users and 0 guests