Something like this might do:
Private Sub ListBox1_MouseM ove(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles ListBox1.MouseM ove
For index As Integer = 0 To Me.ListBox1.Ite ms.Count - 1
Dim r As Rectangle = Me.ListBox1.Get ItemRectangle(i ndex)
If e.Y >= r.Y AndAlso e.Y <= r.Y + r.Height Then
Me.Label1.Text = CStr(Me.ListBox 1.Items(index))
Exit Sub
End If
Next
Me.Label1.Text = "none"
End Sub
This code only looks at the Y value, so it would not work if you had
multiple columns, but you could easily modify it for that. Obviously, I am
just displaying the value in a label, while you would be storing/using the
value in your code, but it should give a decent example of the method to
use. Also, the DragEventArgs will give you X and Y just like
MouseEventArgs.
You mentioned something about a ListViewItem in your post. If you use a
ListView rather than a ListBox, then you can use the GetItemAt method of the
ListView, passing a Point object.
Brian Davis
www.knowdotnet.com
"murl" <mu**@cbsmemphi s.com> wrote in message
news:a1******** *************** ***@posting.goo gle.com...
Im starting on a application that will map fields from an excel file
to fields of a sql table for a very small integration project. I have
enabled drag and drop on the source listbox, and the form inbetween
the 2 listboxes so i can tell when im dragging over the form. Im stuck
on when i dragenter into the 2nd listbox, how can i figure out what
position their mouse is over, and what item is at that x and y
position? If anybody has any information on getting a listview item
and a clientpoint on the listbox, i would greatly appreciate it.
Thanks,
murl