如何为NodeLabelEditEventArgs变量赋值

时间:2014-02-26 14:41:33

标签: vb.net treeview

我创建了这个子

  Sub CreateNewNode(tree As TreeView, e As NodeLabelEditEventArgs)
        Dim nodeTxt As String
        nodeTxt = e.Label

        If e.Node.Level = 0 Then
            Dim obj_carsType As New Cls_carsType
            Dim Entity As New tblcarsType
            Entity.Type = nodeTxt
            obj_carsType .Insert(Entity)

            Dim q = (From i In obj_logsType.Fill Select i.ID).Last

            e.CancelEdit = True
            tree.Nodes.Remove(e.Node)
            tree.Nodes.Add(nodeTxt & " : " & q.tostring)

  end sub

  Sub TreeView1_NodeMouseClick()
     e.Node.ContextMenuStrip =ContextMenuStrip1
  end sub

  Private Sub NEWITEmToolStripMenuItem_Click()

  end sub

在最后一个sub需要调用first sub。也在最后一个如果用户点击NEWITEM我必须调用第一个子我怎么能这样做?请帮帮我

1 个答案:

答案 0 :(得分:0)

我认为你需要这样的东西:

Private Sub NEWITEmToolStripMenuItem_Click(byval sender as object, byval e as eventargs)

CreateNewNode(ctype(sender, TreeView), ctype(e,NodeLabelEditEventArgs))

end sub