Jump to listboxRow

I would like to jump to a listbox row with the same index after clicking on another listbox row. I created this code in the CellClick Event Handler of the 1st Listbox:

var clickedCharacterRow as integer = me.SelectedRowIndex
goto ListBoxCharacters1.RowCount(clickedCharacterRow)

This doesn’t work though, is using GoTo correct or is there another command that does this? I think that RowCount isn’t correct either, but there doesn’t seem to be a RowIndex property available for the ListBoxCharacters1.

There is no Jump and never use Goto.

Look at DesktopListBox to find the correct instruction/syntax.

Basically, you store in a variable the Row you click in,
then you select that Row # in the second DesktopListBox (and eventually, you scroll ti to display it).

Thanks, I got the row focus between the 2 list boxes to work, but still have to manually go to the 2nd listbox. What I would like is after clicking on a row in listbox 1, the program goes to the 2nd listbox and has that row selected. It’s the Jumping to the 2nd listbox that I try to get to work.

You want to set the Focus to the second DesktopListbox ?

You have to AllowFocusRing, then SetFocus.

If you want to select a Row in the second DesktopListbox, use DesktopListBox2.SelectedRowIndex = <Selected Row # of DesktopListBox1>


ListBoxCharacters1.SelectedRowIndex = me.SelectedRowIndex


Sub Change() Handles Change
  me.ScrollPosition = me.SelectedRowIndex
End Sub

I would do this in the Change event because CellClick has some funkiness where the SelectedRowIndex will be set after the ScrollPosition has changed, and even setting the SelectedRowIndex after the scroll doesn’t appear to work. (69587)