Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Delete selection (Read 1791 times)
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
Delete selection
Jan 9th, 2008 at 8:01am
Print Post  
Hello,

I'd like to delete all items in a selection programmatically. All I did until now, I called
Code
Select All
SendKeys.Send("{Delete}"); 


which just serves the purpose.
How can I do this, since I can't go through all items an delete them seperatly?

Best regards,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Delete selection
Reply #1 - Jan 9th, 2008 at 8:43am
Print Post  
Hi,

You can delete all selected items as shown below.

Code
Select All
for (int i = diagram.Selection.Links.Count - 1; i >= 0; i--)
{
	DiagramLink link = diagram.Selection.Links[i];
	diagram.Items.Remove(link);
}

// Delete all nodes from the selection
for (int i = diagram.Selection.Nodes.Count - 1; i >= 0; i--)
{
	DiagramNode node = diagram.Selection.Nodes[i];
	diagram.Items.Remove(node);
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint