Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

EditControl Field, EditEndedEventArgs Class

The control used for cell editing.

Class: EditEndedEventArgs
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public readonly Control EditControl;
Public ReadOnly EditControl As Control

Comments

The control used for cell editing.

Examples

C#

                if (comboBox1.Text == "") { // you MUST select something
                    e.Valid = false;
                    MessageBox.Show("Cell text can't be empty in this example.");
                }
            }
        }
        private void sftTree1_EditEnded(object sender, Softelvdm.SftTreeNET.EditEndedEventArgs e) {

            if (e.EditControl is TextBox) {
                // save the new cell text if neccessary
                if (e.SaveValue)
                    e.Cell.Text = textBox1.Text;

                // hide the text box and make the form the control's parent
                textBox1.Visible = false;
                textBox1.Enabled = false;

VB.NET

        If comboBox1.Text = "" Then ' you MUST select something
            e.Valid = False
            MessageBox.Show("Cell text can't be empty in this example.")
        End If
    End If
End Sub

Private Sub sftTree1_EditEnded(ByVal sender As Object, ByVal e As Softelvdm.SftTreeNET.EditEndedEventArgs) Handles sftTree1.EditEnded
    If TypeOf e.EditControl Is TextBox Then
        ' save the new cell text if neccessary
        If (e.SaveValue) Then
            e.Cell.Text = textBox1.Text
        End If
        ' hide the text box and make the form the control's parent
        textBox1.Visible = False
        textBox1.Enabled = False

See Also EditEndedEventArgs Class | Classes | SftTree/NET 2.0