This is a migrated thread and some comments may be shown as answers.

Treeview Refresh

1 Answer 55 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Nick Jones
Top achievements
Rank 1
Nick Jones asked on 15 Mar 2011, 11:10 AM
Hi, I'm having an issue refreshing the data in my treeview.  Here is the treeview.

'Build Tree View
Private Sub BuildtvOrgan()
    tvOrgan.RelationBindings.Add(New RelationBinding("CompanyDepts", Me.DepartmentBindingSource))
    tvOrgan.RelationBindings.Add(New RelationBinding("Department_Employee", Me.EmployeeBindingSource))
    tvOrgan.RelationBindings.Item(0).DisplayMember = "DeptName"
    tvOrgan.RelationBindings.Item(0).ValueMember = "id"
    tvOrgan.RelationBindings.Item(0).DataSource = DepartmentBindingSource
    tvOrgan.RelationBindings.Item(1).DisplayMember = "FName"
    tvOrgan.RelationBindings.Item(1).ValueMember = "id"
    tvOrgan.RelationBindings.Item(1).DataSource = EmployeeBindingSource
    tvOrgan.DataSource = CompanyBindingSource
    tvOrgan.ValueMember = "id"
    SetImages(tvOrgan.Nodes)
    tvOrgan.ExpandAll()
End Sub

Now, when I modify the underlying data the treeview doesn't change.  It does change if I add data to the underlying tables.  If I add a new Company.Department.Employee to the datatables the treeview updates, with an expandall().  However if I change department A to now be in department C instead of B it doesn't move until I reload the app.  Any idea's anyone?  How can I get the treeview to show changes made to the datasource.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Nick Jones
Top achievements
Rank 1
answered on 15 Mar 2011, 11:47 AM
Think I have resolved this.  treeview.BeginUpdate and Endupdate.  Seems to have fixed it.

Tags
DropDownList
Asked by
Nick Jones
Top achievements
Rank 1
Answers by
Nick Jones
Top achievements
Rank 1
Share this question
or