Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Operation is not valid due to the current state of the object.
 

Operation is not valid due to the current state of the object.

Somebody got a clue about this message:
 Operation is not valid due to the current state of the object.

regards remco
RemcoJVG  Wednesday, September 28, 2005 4:18 PM
I inherit from panel and added a few controls on it such as labels and the like
a few properties and subs and thats it, nothing fancy
In an other project i got the same error when inherriting from panel

It compiles and works fine but when i enter the designer i got this error

When i click on the error on the tasklist nothing happend


Remco
RemcoJVG  Thursday, September 29, 2005 4:34 PM
Can you give some more details? What exactly are you trying to do?
Roxana Ungureanu  Thursday, September 29, 2005 3:56 PM
I inherit from panel and added a few controls on it such as labels and the like
a few properties and subs and thats it, nothing fancy
In an other project i got the same error when inherriting from panel

It compiles and works fine but when i enter the designer i got this error

When i click on the error on the tasklist nothing happend


Remco
RemcoJVG  Thursday, September 29, 2005 4:34 PM
I figured it out

When you iherrit from a control (not usercontrol) and dropping controls on it eg a button it starts complaining in the disigner

Remco
RemcoJVG  Friday, October 07, 2005 11:15 AM
Hi,

I'm getting this  Operation is not valid due to the current state of the object. Exception at runtime.
I'm inheriting DatagridView and I've override following methods from DataGridView class. to implement custom sorting and some special ColumnHeader painting.

OnCellPainting

OnColumnHeaderMouseClick

I've set object (from my source) as datasource for the grid. At runtime I start separate thread to read data from Database and then add objects to the datasource. on <objName>bindingsource.Add(object obj) method I get above mentioned error.
When I replaced my custom grid with DatagridView everything works fine.
P.S. I'm using .NET Framework 2.0 RTM

Thanks in advance
Sameer
Sameer.V  Monday, November 14, 2005 5:31 PM

Remco,

Are the complaints anything to be concerned about? Is there something I can do to prevent them? I'm assuming I'm probably doing something "wrong" in my class from the designer's perspective and that there must be something that I should surround with an if(!this.DesignMode){} block, but I'm not sure what is causing the complaint. How can I figure out what code causes the complaint?

TerriP

TerriP  Tuesday, February 07, 2006 7:09 PM

In my case it only complains in designtime not in runtime, so no concern about that. my (wild) gues is that the disigner don't like controls added and setting properties (initialisizecomponent) in disigntime on the control surface. notice that a control is shown as a pictogram instead of the actual control.

Remco

RemcoJVG  Wednesday, February 08, 2006 1:48 PM
Hi,

I am getting this same error in Managed DirectX. I'm trying to write data to a vertex buffer but it throws a run time exception with this error. I do a similar operation with an index buffer and it works fine. Any thoughts?


Thanks,
b4r0qu3 1337 d00d  Wednesday, May 24, 2006 4:01 PM
I'm getting the exact same error for trying to write to a VertexBuffer as well! I'm trying to write more points than 3 in the buffer for the Managed DirectX 9 SDK .... Tutorial example 2, so I can have DirectX draw it as a LineList, LineStrip, or another.

How would the program 'state' know how many Vertices should be written at once?
It hadn't even gotten to the point where TriangleList was declared as the method desired. In fact, I commented out the line of code, and it still gives the error. How can a VertexBuffer only accept 3 Vertices at a time? Is this true? Anyone knowing why this error comes up, please help.

-Ambiguous User
Ambiguous User  Monday, November 13, 2006 1:25 AM
I am getting this error while developing custom workflow using Sequential Workflow (Visual Studio 2008). Does anybody have any clue?
gpoonam13  Tuesday, December 23, 2008 10:55 AM
I got this while trying to delete a "SEALED" field from a sharepoint field collection using the sharepoint API, unsealing it first allowed me to continue.
KrisP_68  Thursday, October 01, 2009 10:20 AM

You can use google to search for other answers

Custom Search

More Threads

• CommandText Property Editor
• Extending the ContextMenu Class
• How to change the color of textbox after set enable to false?
• Using Web Form Designer in a Windows Form Application
• Showing the selected rectangle in the Designer
• how to add one more control in open dialog box
• Accessing Resources
• Custom Designer Problem - Customise the resize handle arround a user control
• Design-time functionality at run-time
• Failure to load designer due to VS2005B2 fault