Event parameters used for events that take a node collection,
a Boolean for displaying a message, and are cancelable.
Object Model
Syntax
| Visual Basic (Declaration) | |
|---|
Public Class BeforeNodesDeletedEventArgs
Inherits CancelEventArgs |
| C# | |
|---|
public class BeforeNodesDeletedEventArgs : CancelEventArgs |
Example
The following sample code illustrates some of the information available in the BeforeDelete event.
For an overview of how to handle events in Visual Basic or Visual C#, see
Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see
Consuming Events in the
.NET Framework Developer's Guide.
| Visual Basic | Copy Code |
|---|
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
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
e.DisplayPromptMsg = False
End Sub
|
| C# | Copy Code |
|---|
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;
}
|
See Also