By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,616 Members | 1,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,616 IT Pros & Developers. It's quick & easy.

Listbox SelectedItem & Dragging

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.