我在VB6
中编写的代码如下:
Private Sub TreeView1_Click()
mLastSelectedTab = TreeView1.SelectedItem.Index
TreeView1.SelectedItem.Bold = True
mNodeItem.DoSelection "Items", TreeView1.SelectedItem.Index
TreeView1.Enabled = True
End Sub
我在VB.NET
中编写的代码是这样的:
Private Sub TreeView1_Click(ByVal eventSender As System.Object, ByVal eventArgs As TreeViewEventArgs) Handles TreeView1.AfterSelect
mLastSelectedTab = TreeView1.SelectedNode.Index
TreeView1.SelectedNode.NodeFont = New Font(TreeView1.Font, FontStyle.Bold)
mNodeItem.DoSelection("Items", TreeView1.SelectedNode.Index)
TreeView1.Enabled = True
End Sub
但是我遇到的问题是点击TreeViewNode
时我得到了TreeView1.SelectedItem.Index
的不同结果。在VB6
中,它获得的值与列表中输入的顺序相同,但在VB.NET
中,它在订单项中获取的值显示在列表中。