Posted 17 April 2019, 6:38 am EST
Winforms C1Tree View v4.0.20191.359
I have a datatable bound to the TreeView and it renders properly.
Table is
ID
ClassID (not displayed used for database to assemble the data)
Level number (not displayed used for database to assemble the data)
Parent ID
Display Name
The ID, and display name are properly bound. Again it displays properly.
The following VB.NET code is used to respond to a context menu that is activted on a right click:
Private Sub tsmiNewFolder_Click(sender As Object, e As EventArgs) Handles tsmiNewFolder.Click
Dim _newDR As DataRow = DirectCast(tvBrowse.BindingInfo.DataSource, DataTable).NewRow()
_newDR("F_NAME") = "New Folder"
_newDR("TR_LEVEL") = CInt(_activeDR("TR_LEVEL")) + 1
_newDR("TR_PARENT_F_ID") = CInt(_activeDR("TR_F_ID"))
_newDR("TR_F_ID") = -1
DirectCast(tvBrowse.BindingInfo.DataSource, DataTable).Rows.Add(_newDR)
tvBrowse.BeginEdit()
End Sub
_activeDR is populated by doing a getvalue on the selected row in the MouseUp event, and is correctly.
[b]What I cannot do is select the newly created node in order to allow the end user to type in the name of the folder. I don’t want to create a popup.
I cannot find a method that gives me the index of the newly created node.
As an aside I tried to create a node and set its value to the data row, but that creates an empty row in addition to the new row in the data table. The above code highlights and edits the parent node of the newly created node.[/b]
Again, the documentation and samples don’t appear to demonstrate this functionality. A search of the forum also did not appear to give a solution.
Please assist.
Thanks.