467,104 Members | 971 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

Listbox SelectedItem & Dragging

I have a Windows app (.net v1.1) and I am dragging from a list box.

The first drag works fine, but all subsequent drags continue to pull the
first item that was dragged. It appears that MouseDown does not cause the
SelectedItem to change (even though the highlighted item changes).

So, if I click down on a non-highlighted item and drag it off the list box,
the new item looks selected, but is not really the SelectedItem. I see that
the SelectedItem is only changed on MouseUp, which never happens because I
dragged off of the list box.

Is there something I can put in mouse down to select the new item? This
would make SelectedItem act like the highlighting does, which would make more
sense and fix the issue with dragging.

Thank you for your assistance,
Mark Lauser
Nov 21 '05 #1
  • viewed: 1838
Share:
3 Replies
Mark,

Ask this to the guy who made the program

He can see maybe something in the code from by instance the mouse down event
you are talking about.

We don't have nothing to see that here.

I hope this helps,

Cor
Nov 21 '05 #2
Cor,

I am the guy who made the program.

There is no code to look at in the mouse down event. I was hoping that
someone familiar with dragging and dropping from list boxes could help me
figure out what code to put in there so that the list box item is selected as
soon as the mouse down event occurs.

Thank you,
Mark Lauser

"Cor Ligthert" wrote:
Mark,

Ask this to the guy who made the program

He can see maybe something in the code from by instance the mouse down event
you are talking about.

We don't have nothing to see that here.

I hope this helps,

Cor

Nov 21 '05 #3
Use the IndexFromPoint function of the ListBox and use the X and Y of the
MouseEventArgs (e) to specify the point:

Dim index As Integer = ListBox.IndexFromPoint(New Point(e.X, e.Y))
If index >= 0 Then ListBox.SelectedIndex = index

Have a nice day,
Mark Lauser
"Mark Lauser" wrote:
I have a Windows app (.net v1.1) and I am dragging from a list box.

The first drag works fine, but all subsequent drags continue to pull the
first item that was dragged. It appears that MouseDown does not cause the
SelectedItem to change (even though the highlighted item changes).

So, if I click down on a non-highlighted item and drag it off the list box,
the new item looks selected, but is not really the SelectedItem. I see that
the SelectedItem is only changed on MouseUp, which never happens because I
dragged off of the list box.

Is there something I can put in mouse down to select the new item? This
would make SelectedItem act like the highlighting does, which would make more
sense and fix the issue with dragging.

Thank you for your assistance,
Mark Lauser

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by mathieu cupryk | last post: by
2 posts views Thread by David Ichilov | last post: by
10 posts views Thread by yop | last post: by
2 posts views Thread by Allan Horwitz | last post: by
6 posts views Thread by Sparky Arbuckle | last post: by
3 posts views Thread by thomasp@msala.net | last post: by
1 post views Thread by jasydnor | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.