What-ho,
OK, here we go....
I've got a TreeView control full of Node objects, which I have to peform an update on (I'm just populating it from a database, so I go through the population function again). Before the update takes place, one of the nodes is going to have been selected by the user (aggravating fool) and performing the update loses which node object was selected. To get around this, I set a node object variable to whatever the TreeView.SelectedItem is and then perform the update function. After updating the TreeView, I then attempt to set the TreeView.SelectedItem to the Node object I set before the update, like this:
Set TreeView.SelectedItem = nodUserSelected
where nodUserSelected is the preset node object.
However, despite the fact that the TreeView object is populated and the Node object variable is set and contains a valid node object which may be found in the TreeView.Nodes collection, it fails to set the selected item. This results in an object error when I attempt to set the selected item to be viewable, like this:
TreeView.SelectedItem.EnsureVisible
which is understandable, as the SelectedItem object is currently set to Nothing.
So why's that then?
Cheerio,
Paul [sig][/sig]
OK, here we go....
I've got a TreeView control full of Node objects, which I have to peform an update on (I'm just populating it from a database, so I go through the population function again). Before the update takes place, one of the nodes is going to have been selected by the user (aggravating fool) and performing the update loses which node object was selected. To get around this, I set a node object variable to whatever the TreeView.SelectedItem is and then perform the update function. After updating the TreeView, I then attempt to set the TreeView.SelectedItem to the Node object I set before the update, like this:
Set TreeView.SelectedItem = nodUserSelected
where nodUserSelected is the preset node object.
However, despite the fact that the TreeView object is populated and the Node object variable is set and contains a valid node object which may be found in the TreeView.Nodes collection, it fails to set the selected item. This results in an object error when I attempt to set the selected item to be viewable, like this:
TreeView.SelectedItem.EnsureVisible
which is understandable, as the SelectedItem object is currently set to Nothing.
So why's that then?
Cheerio,
Paul [sig][/sig]