Hi,
I need to have the focus back to a listbox that on click hilight a row in a second listbox, so:
from listbox1 on click I set focus to listbox2 (after got the param to find)
cycle with for each row in listbox2 and if param is found I set listIndex to the row
until here everything ok, but then I need to setFocus back to listbox1, but give me error: Unable to setfocus to a controllistbox2 (or something similar, I dont have access in english language)
here my example code:
Private Sub listBox1_Click()
Me.itemSel = listBox1.Column(1)
Dim i As Long
Me.listBox2.SetFocus
Me.listBox2.ListIndex = -1
For i = 0 To listBox2.ListCount - 1
If listBox2.Column(7, i + 1) = Me.itemSel Then
Me.listBox2.ListIndex = i
Me.Repaint
Exit For
End If
Next
Me.listBox1.SetFocus
End Sub
Any clues if it possible to move the focus many time in the same sub?
I tryed also to call a secondo sub with the setfocus back, but same result.
Thank you
Stefano
I need to have the focus back to a listbox that on click hilight a row in a second listbox, so:
from listbox1 on click I set focus to listbox2 (after got the param to find)
cycle with for each row in listbox2 and if param is found I set listIndex to the row
until here everything ok, but then I need to setFocus back to listbox1, but give me error: Unable to setfocus to a controllistbox2 (or something similar, I dont have access in english language)
here my example code:
Private Sub listBox1_Click()
Me.itemSel = listBox1.Column(1)
Dim i As Long
Me.listBox2.SetFocus
Me.listBox2.ListIndex = -1
For i = 0 To listBox2.ListCount - 1
If listBox2.Column(7, i + 1) = Me.itemSel Then
Me.listBox2.ListIndex = i
Me.Repaint
Exit For
End If
Next
Me.listBox1.SetFocus
End Sub
Any clues if it possible to move the focus many time in the same sub?
I tryed also to call a secondo sub with the setfocus back, but same result.
Thank you
Stefano