Previous | Index | Next 

[INFO] Minor differences between VB6 and VB.NET TreeView controls

VB Migration Partner’s support library hides most of the differences between the VB6 and the .NET versions of the TreeView control, but not all of them. In most cases the remaining differences should have no impact on migrated programs. Here’s their complete list:

  1. The FullRowSelect property has effect in the .NET TreeView control only if the Style property has a value in the range 0-3 – that is, the values tvwTextOnly, tvwPictureText, tvwPlusMinusText, and tvwPlusMinusPictureText. In other words, if the current style includes tree lines, the .NET control never highlight the currently selected node.
  2. The StartLabelEdit method of the .NET control works only if the LabelEdit property is 0-tvwAutomatic, whereas it always works in the VB6 control. (VB Migration Partner inserts a warning just before the call to StartLabelEdit.)
  3. The DropHighlight property has no effect and is therefore marked as obsolete. However, the property retains the value you assign to it.
  4. The CreateDragImage method of the Node object isn’t supported and is marked as obsolete. Invoking this method throws an exception (if VBConfig.ThrowOnUnsupportedMembers is True).
  5. If your application invokes the StartLabelEdit on the current node from inside the TreeView’s Click event handler, the control doesn’t enter edit mode if the user clicks right on the TreeView node; however, if he or she clicks on the control’s blank area, the StartLabelEdit method works correctly. This weird behavior is caused by the fact that, when the node is clicked, the control raises a LostFocus event immediately after the Click event, and the LostFocus event immediately ends the editing mode. You can work around this issue by invoking the StartLabelEdit from inside the MouseUp event handler.
  6. When you move the focus from the TreeView control to another control, the VB6 TreeView control raises the Validate event and then the LostFocus event; the .NET TreeView control generates the LostFocus event first, and then the Validate event.
  7. If the input focus is corrently on the .NET TreeView control and you then activate another application and finally go back to the .NET application, the control raises several LostFocus and GotFocus events. The VB6 TreeView control doesn’t raise all these extra events.
  8. When you move the input focus to a VB6 TreeView control using the mouse, the event sequence is: MouseDown, GotFocus, MouseUp. The same operation causes the .NET control to raise the events in this order: GotFocus, MouseDown, MouseUp.
  9. The VB6 TreeView control raises a Click event also if you click on the control’s blank area, whereas the .NET TreeView control raises the Click event only if you click on a node.
  10. When you edit a node’s label, the .NET TreeView control raises the following events: BeforeLabelEdit, LostFocus, AfterLabelEdit, GotFocus. The VB6 ListView control raises only the BeforeLabelEdit and AfterLabelEdit events.
  11. When you click on the checkbox associated with a node, the VB6 TreeView control raises the following events: MouseDown, NodeCheck, MouseUp, Click. In the same circumstances the .NET control fires these events: MouseDown, NodeCheck, NodeClick, Click, MouseUp.
  12. The Nodes.Add method allows to omit its first parameter, which in this case is simply ignored. Conversely, under VB6 this situation causes an error 35610 “Invalid object”.

 

Previous | Index | Next