Option Explicit
Dim sNodeText As String
Private Sub Form_Load()
TreeView1.Nodes.Add , , , "test"
TreeView1.Nodes.Add , , , "test 1"
TreeView1.Nodes.Add , , , "test 2"
End Sub
Private Sub Timer1_Timer()
TreeView1.StartLabelEdit
Timer1.Enabled = False
End Sub
Private Sub TreeView1_AfterLabelEdit(Cancel As Integer, NewString As String)
If Len(NewString) < 1 Then
MsgBox "Error! You must enter a value"
Timer1.Interval = 100
Timer1.Enabled = True
End If
End Sub
Private Sub TreeView1_BeforeLabelEdit(Cancel As Integer)
If Len(TreeView1.SelectedItem.Text) > 0 Then
sNodeText = TreeView1.SelectedItem.Text
End If
End Sub
Private Sub TreeView1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
TreeView1.SelectedItem.Text = sNodeText
End If
End Sub
Sunday, June 17, 2012
Rename Node TreeView Seperti Pada Explorer
Labels:
TreeView