Hi,
I send this problem for the second time because the code i have received in response to it did'nt work well
When i click in a listview called listview1 the selected term color becomes 'magenta'(its highlighttext).
The fact is that when i select another term of the listview1, its color becomes also 'magenta' but the first selected term remains with color 'magenta', what i don't want to.
how can i correct this to see only the last selected term in magenta color in the listview1
Here is the code of the click event on the listview1.
CODE
Private Sub ListView1_ItemActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.ItemActivate
Dim iSelectedTermeID As Integer, strLibTerme As String
'Dim nNode1 As TreeNode
'déclaration de deux arrays qui vont contenir plusieurs lignes
Dim drNAs() As DataRow, drSyns() As DataRow, drNA As DataRow, drSYN As DataRow
Dim nNANode As TreeNode, nSynNode As TreeNode
If Not ListView1.FocusedItem Is Nothing AndAlso Not ListView1.FocusedItem.Tag Is Nothing Then
' ListView1.FocusedItem.ForeColor = SystemColors.HighlightText.Magenta
iSelectedTermeID = CType(ListView1.FocusedItem.Tag, Integer)
[/CODE]
Secondly,
When i select one term in the listview1, this term appears also selected in a treeview called 'treeview1' (below the listview1) and its backcolor becomes DeepSkyBlue ( in the treeview1).
the problem is that when i select another term in the listview1, the first selected term remains selected in the treeview1 with its backcolor DeepSkyBlue, what i don't want.
I only want the last selected term with backcolor = deepskyblue.
Could you help me on this point.
Thanks a lot for your help.
Best regards
Here is the code of the listview1_itemactivate
CODE
Private Sub ListView1_ItemActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.ItemActivate
Dim iSelectedTermeID As Integer
Dim nNode1 As TreeNode
If ListView1.SelectedItems.Count > 0 Then
iSelectedTermeID = ListView1.SelectedItems(0).Tag
nNode1 = FindNode(iSelectedTermeID, TreeView1.Nodes)
If Not nNode1 Is Nothing Then
'TreeView1.Focus()
TreeView1.SelectedNode = nNode1
nNode1.BackColor = SystemColors.Highlight.DeepSkyBlue
nNode1.ForeColor = SystemColors.HighlightText.MediumSlateBlue
nNode1.ExpandAll()
End If
[/CODE]
I send this problem for the second time because the code i have received in response to it did'nt work well
When i click in a listview called listview1 the selected term color becomes 'magenta'(its highlighttext).
The fact is that when i select another term of the listview1, its color becomes also 'magenta' but the first selected term remains with color 'magenta', what i don't want to.
how can i correct this to see only the last selected term in magenta color in the listview1
Here is the code of the click event on the listview1.
CODE
Private Sub ListView1_ItemActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.ItemActivate
Dim iSelectedTermeID As Integer, strLibTerme As String
'Dim nNode1 As TreeNode
'déclaration de deux arrays qui vont contenir plusieurs lignes
Dim drNAs() As DataRow, drSyns() As DataRow, drNA As DataRow, drSYN As DataRow
Dim nNANode As TreeNode, nSynNode As TreeNode
If Not ListView1.FocusedItem Is Nothing AndAlso Not ListView1.FocusedItem.Tag Is Nothing Then
' ListView1.FocusedItem.ForeColor = SystemColors.HighlightText.Magenta
iSelectedTermeID = CType(ListView1.FocusedItem.Tag, Integer)
[/CODE]
Secondly,
When i select one term in the listview1, this term appears also selected in a treeview called 'treeview1' (below the listview1) and its backcolor becomes DeepSkyBlue ( in the treeview1).
the problem is that when i select another term in the listview1, the first selected term remains selected in the treeview1 with its backcolor DeepSkyBlue, what i don't want.
I only want the last selected term with backcolor = deepskyblue.
Could you help me on this point.
Thanks a lot for your help.
Best regards
Here is the code of the listview1_itemactivate
CODE
Private Sub ListView1_ItemActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.ItemActivate
Dim iSelectedTermeID As Integer
Dim nNode1 As TreeNode
If ListView1.SelectedItems.Count > 0 Then
iSelectedTermeID = ListView1.SelectedItems(0).Tag
nNode1 = FindNode(iSelectedTermeID, TreeView1.Nodes)
If Not nNode1 Is Nothing Then
'TreeView1.Focus()
TreeView1.SelectedNode = nNode1
nNode1.BackColor = SystemColors.Highlight.DeepSkyBlue
nNode1.ForeColor = SystemColors.HighlightText.MediumSlateBlue
nNode1.ExpandAll()
End If
[/CODE]