473,804 Members | 4,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
3 2027
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.IndexFr omPoint(New Point(e.X, e.Y))
If index >= 0 Then ListBox.Selecte dIndex = 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2121
by: mathieu cupryk | last post by:
I have problems with listboxes in the webform2.cs, the textboxes are working well when I do a click on next. I am missing something. It works with the textboxes. Here is the file: using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Data; using System.Drawing;
2
13457
by: David Ichilov | last post by:
I've class derived from "Object" class, with ToString() method overriden itc. , now i add object of this class to Windows.Forms.ListBox.Items collection, and it works fine, displaying what ToString() should return... then the program is in the runtime, i chage fields of this object in thet way ( (MyClass)ListBox.SelectedItem ).SomeProperty = newValue; so ToString() method now will return new value, but text showed in a listbox itself...
10
2256
by: yop | last post by:
All When I try to get the text from my listbox I am get an error which is listed below. Any ideas? Thanks Object reference not set to an instance of an object.
2
1357
by: Allan Horwitz | last post by:
When I try to reference the lstproducts.selecteditem.value using autopostback from the lstproducts listbox I get an error? How can I fix my code to get the selected value from the lstproducts listbox? Any help will be appreciated. Sincerely, Allan
4
2465
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item, what do I need to do in order to return the "option value" of the control? Moe !--- returned value of the control
6
1561
by: Sparky Arbuckle | last post by:
The code below works to an extent. The problem with it is that no matter which item is selected, the first one in the list is always the item that gets added/removed. How can I alleviate this problem? I have tried If Not Page.IsPostBack and still nothing. Private Sub btnCol1ToCol2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCol1ToCol2.Click Dim s As String = lbColumn1.SelectedItem.Text()...
3
3306
by: thomasp | last post by:
Has anyone got some sample code to do drag and drop from one listbox to another listbox using VB.Net 2005. The below code works for draging and droping one at a time, but not for multiselected items. I tried setting up an array to capture the selected items and then move them with the dragndrop code, but after selecting the items when the user clicks on the items to drag them the selection goes back to one item. Also I have code for the...
2
9801
by: Pat | last post by:
I'm a newbie to c# and could use some help - been banging my head on the keyboard for 3 days now. I have an unbound listbox that I'm populating this way: 1. loop through a datatable and load row into row object 2. Check one of the row columns against a dictionary key 3. If it's found, add it to the listbox. Then I want to pass the actual item that shows up in the listbox
1
1716
by: jasydnor | last post by:
Hi, New to the forums and have a question. I've only been developing for about five months now so I apologize if this seems oversimplistic....I am writing a program on an idea I had on a whim. It's based on the fact that a store (Wal-Mart) is laid out in a logical manner and you can shop efficiently if your shopping list is in order. What I have are two listboxes, the left one contains all the items I might buy and as you double click on...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.