Hey there

I'm using this code to select an item in a ListBox when a user right clicks on it
VB Code:
  1. Private Sub listOnline_MouseDown(ByVal sender As System.Object, _
  2. ByVal e As System.Windows.Forms.MouseEventArgs) Handles listOnline.MouseDown
  3.             If e.Button = Windows.Forms.MouseButtons.Right Then
  4.                 Dim mouseY As Integer = listOnline.PointToClient(Windows.Forms.Cursor.Position).Y
  5.                 Dim itemIndex As Integer = (mouseY \ listOnline.ItemHeight) - listOnline.TopIndex
  6.                 listOnline.SelectedIndex = itemIndex
  7.  
  8.                 listOnline.ContextMenuStrip = blockMenu
  9.                 Dim myString As String = listOnline.SelectedItem
  10.                 Dim mySplit(2) As String
  11.                 mySplit = Split(myString, " - ")
  12.                 If InStr(mySplit(0), "¤") Then
  13.                     Block.Text = "Unblock: " & mySplit(2)
  14.                 Else
  15.                     Block.Text = "Block: " & mySplit(2)
  16.                 End If
  17.             End If
  18.     End Sub
It works great....but....my list is bigger than the container so a scrollbar appears, I can only rightclick select things that appear in the ListBox when the scrollbar is all the way up, if I scroll down and try to rightclick select something it wont work. It basically selects the "wrong" item....the item that would be in that place if the scrollbar was all the way up....

It probably has something to do with this:
VB Code:
  1. Dim itemIndex As Integer = (mouseY \ listOnline.ItemHeight) - listOnline.TopIndex
.....what could I use instead to make it work?