'Declaration Public Delegate Sub BeforeNodeDeleteChangedEventHandler( _ ByVal sender As Object, _ ByVal e As BeforeNodesDeletedEventArgs _ )
public delegate void BeforeNodeDeleteChangedEventHandler( object sender, BeforeNodesDeletedEventArgs e )
Imports Infragistics.Win.UltraWinTree Private Sub ultraTree1_BeforeDelete(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.BeforeNodesDeletedEventArgs) Handles ultraTree1.BeforeDelete Dim sb As New System.Text.StringBuilder() sb.Append("The following nodes are about to be deleted: ") Dim node As UltraTreeNode ' Loop over the nodes that are about to be deleted. ' Note: The Nodes collection exposed by the event args ' is read-only. For Each node In e.Nodes sb.Append(node.Key) sb.Append(", ") Next sb.Append(" Press ''OK'' or ''Cancel''.") Dim dr As DialogResult dr = MessageBox.Show(Me, _ sb.ToString(), _ "Deleting Nodes", _ MessageBoxButtons.OKCancel) If dr = DialogResult.Cancel Then e.Cancel = True ' Set the DisplayPromptMsg flag to false so the ' default messagebox will be suppressed. e.DisplayPromptMsg = False End Sub
using System.Diagnostics; using Infragistics.Win.UltraWinTree; private void ultraTree1_BeforeDelete(object sender, Infragistics.Win.UltraWinTree.BeforeNodesDeletedEventArgs e) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("The following nodes are about to be deleted: "); // Loop over the nodes that are about to be deleted. // Note: The Nodes collection exposed by the event args // is read-only. foreach ( UltraTreeNode node in e.Nodes ) { sb.Append( node.Key ); sb.Append( ", " ); } sb.Append(" Press ''OK'' or ''Cancel''."); DialogResult dr = MessageBox.Show( this, sb.ToString(), "Deleting Nodes", MessageBoxButtons.OKCancel ); if ( dr == DialogResult.Cancel ) e.Cancel = true; // Set the DisplayPromptMsg flag to false so the // default messagebox will be suppressed. e.DisplayPromptMsg = false; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2