Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problem deleting Object from FLowChart (Read 2848 times)
cenanove
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jun 25th, 2009
Problem deleting Object from FLowChart
Jun 25th, 2009 at 9:33pm
Print Post  
Hi,

I have problem deleting object from the flowchart.
Here is code:
              try
{
foreach(Arrow obj in objectsToDelete)
{

    if (manager.FlowChart.Arrows.Contains(obj))
{
manager.FlowChart.DeleteObject(obj);
}
}
}
catch (Exception ex)
{
string        s=ex.Message;
}


I have two arrows inside collection objectsToDelete, first one is deleted without problems and second one passes   “if (manager.FlowChart.Arrows.Contains(obj))" but fails on flowchart.DeleteObject with Error:
ex.Message"Cannot remove the specified item because it was not found in the specified Collection."

Could anyone help please?

Thanks.

Enver.


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem deleting Object from FLowChart
Reply #1 - Jun 26th, 2009 at 5:23am
Print Post  
What is the full exception stack trace? Are you handling any Deleted events?
  
Back to top
 
IP Logged
 
cenanove
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jun 25th, 2009
Re: Problem deleting Object from FLowChart
Reply #2 - Jun 26th, 2009 at 3:21pm
Print Post  
This is  exception stack trace?


ex.ToString()"System.ArgumentException: Cannot remove the specified item because it was not found in the specified Collection.\r\n   at System.Collections.CollectionBase.System.Collections.IList.Remove(Object value)\r\n   at MindFusion.FlowChartX.ArrowCollection.Remove(Arrow a)\r\n   at MindFusion.FlowChartX.Selection.x715ab1b7ea8d866b(ChartObject xa59bff7708de3a18)\r\n   at MindFusion.FlowChartX.Selection.RemoveObject(ChartObject obj)\r\n   at MindFusion.FlowChartX.FlowChart.xa456762ceebce31f(ChartObject xccb63ca5f63dc470)\r\n   at MindFusion.FlowChartX.Commands.RemoveItemCmd.Execute(Boolean undoEnabled)\r\n   at MindFusion.FlowChartX.UndoManager.x2bab335568e5c4c6(Command x61b060a94340c4fc)\r\n   at MindFusion.FlowChartX.Commands.RemoveItemCmd.Execute()\r\n   at MindFusion.FlowChartX.FlowChart.x9c02b19c3454013a(ChartObject xccb63ca5f63dc470)\r\n   at MindFusion.FlowChartX.FlowChart.DeleteObject(ChartObject obj)\r\n   at FacT.Library.FlowChartPipelineDeleteManager.FinalDeleteBRN() in c:\\fact_current\\fact\\uiclasses\\deleting\\flowchartpipelinedeletemanager.cs:l
ine 592\r\n   at FacT.Library.FlowChartPipelineDeleteManager.DeleteBRN(Arrow a) in c:\\fact_current\\fact\\uiclasses\\deleting\\flowchartpipelinedeletemanager.cs:l
ine 82\r\n   at FacT.Library.FlowChartManager.DeleteBRN(Arrow a) in c:\\fact_current\\fact\\uiclasses\\flowchartmanager.cs:line 485\r\n   at FacT.Library.ProjectEdit.RemoveSelectionFromTheGraph() in c:\\fact_current\\fact\\forms\\projectedit.cs:line 10856"string
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem deleting Object from FLowChart
Reply #3 - Jun 29th, 2009 at 1:55pm
Print Post  
Do your Deleted event handlers run any code that changes the selection? What happens if you clear the selection before starting the loop over objectsToDelete?
  
Back to top
 
IP Logged
 
wushuang83
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Jul 1st, 2009
Re: Problem deleting Object from FLowChart
Reply #4 - Jul 1st, 2009 at 8:16am
Print Post  
you can do it like this:
for (int i = flowChart1.Boxes.Count; i > 0; i--)
{
delete your object;
}

you have 2 obj,boxes[0] is A,and boxes[1] is B,if you delete Boxes[0] A,now Boxes[1] B will change to Boxes[0] B.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint