Hi I am creating a treeview dynamically when a node is clicked on
I also have assigned a imagesList to the treenode
as can be seen in my code, dependent on whether the person is male or female a different images is shown
initially everything looks ok, however, if you click on any child node where the parents imageIndex is 1 (i.e. female) then that person imageIndex somehow is reset to 0 (male).
no where else in my code do i assign imageIndexes for treenodes so I can only assume that the 0 index is the default and gets assigned to the newly opened treenode.
Would this be the case? and how would i stop this happening?
thanks in advance
I also have assigned a imagesList to the treenode
as can be seen in my code, dependent on whether the person is male or female a different images is shown
initially everything looks ok, however, if you click on any child node where the parents imageIndex is 1 (i.e. female) then that person imageIndex somehow is reset to 0 (male).
no where else in my code do i assign imageIndexes for treenodes so I can only assume that the 0 index is the default and gets assigned to the newly opened treenode.
Would this be the case? and how would i stop this happening?
thanks in advance
VB.NET:
'get all the other employees for this emp
Dim datareader As SqlDataReader = GetSqlData.GetAllEmpsForEmpNo(sEmpNo, sConnectionString)
Dim nodeIndex As Integer = 0
While datareader.Read()
bOtherTitle = False
bIsMale = CheckMale(datareader.GetString(0))
tvStructure.SelectedNode.ForeColor = TextColor(iColorCount)
tvStructure.SelectedNode.Nodes.Add(datareader.GetString(0))
'assign the images index to the treenode
If bIsMale = True Then
tvStructure.SelectedNode.Nodes(nodeIndex).ImageIndex = 0
ElseIf bIsMale = False And bOtherTitle = False Then
tvStructure.SelectedNode.Nodes(nodeIndex).ImageIndex = 1
ElseIf bOtherTitle = True Then
tvStructure.SelectedNode.Nodes(nodeIndex).ImageIndex = 2
End If
nodeIndex = nodeIndex + 1
End While