473,804 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect column in list box mouse click

With a multiple column listbox, I'd like to be able to change the sort
by allowing the user to click on a column. Is there a practical way
detect in which column the user clicked?

I know this could be done with a datasheet subform, but I was hoping to
be able to use the listbox.

Any suggestions?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
May 5 '06 #1
3 5141

"Randy Harris" <pl****@send.no .spam> schreef in bericht news:wP******** ***********@new ssvr14.news.pro digy.com...
With a multiple column listbox, I'd like to be able to change the sort
by allowing the user to click on a column. Is there a practical way
detect in which column the user clicked?

I know this could be done with a datasheet subform, but I was hoping to
be able to use the listbox.

Any suggestions?


Hi Randy,

AFAIK you can't detect the column clicked with a listbox (at least I can't ...)
but I have an idea:
- Use a listbox *without* the columnheads
- Create 'columnheads' yourself (you could use labels for this)
Just place the labelcontrols above your listbox with the proper width and so on.
Use the columnnames for the caption (and backstyle normal, backcolor white)

This will look almost the same as a listbox with columnheads
Then you can use the click-event of the labels to do whatever you like

Arno R
May 5 '06 #2
See how it is done in this solution:
http://www.lebans.com/listboxcolumnresize.htm
ListBoxColumnRe size.zip is a Class that allows the user to resize the
ColumnWidths of a ListBox at Runtime.Also supports an Autosizing method for
the ColumnWidths.

Version 2.2 April 27/2002

Modified Columns AutoSizing method to work with both ListBox and Combo
controls.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

"Randy Harris" <pl****@send.no .spam> wrote in message
news:wP******** ***********@new ssvr14.news.pro digy.com...
With a multiple column listbox, I'd like to be able to change the sort by
allowing the user to click on a column. Is there a practical way detect in
which column the user clicked?

I know this could be done with a datasheet subform, but I was hoping to be
able to use the listbox.

Any suggestions?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

May 5 '06 #3
Randy there is code/logic to handle that issue here:
http://www.lebans.com/listboxcolumnresize.htm
ListBoxColumnRe size.zip is a Class that allows the user to resize the
ColumnWidths of a ListBox at Runtime.Also supports an Autosizing method for
the ColumnWidths.

Version 2.2 April 27/2002

Modified Columns AutoSizing method to work with both ListBox and Combo
controls.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

"Randy Harris" <pl****@send.no .spam> wrote in message
news:wP******** ***********@new ssvr14.news.pro digy.com...
With a multiple column listbox, I'd like to be able to change the sort by
allowing the user to click on a column. Is there a practical way detect in
which column the user clicked?

I know this could be done with a datasheet subform, but I was hoping to be
able to use the listbox.

Any suggestions?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

Jun 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4933
by: Benoit Martin | last post by:
Is it possible to detect a mouse click from a .net service. I want a process running in the background that will detect when the user clicks the mouse button (anywhere on the screen) and executes an action accordingly. All the event handlers for the mouse that I see are for Windows Forms. Is there a way to do it without any controls on the screen? Thanks
2
18889
by: Serge | last post by:
Hi, in my windows.forms application I have added a goupBox control to my windows.form. Now I want to know the x,y-position from the mouse cursor when I click on the groupBox. The strange thing is that the mouse click event does not exist. Does anyone know how to get teh x,y position of the mouse cursor when you click in a groupbox control ?
3
1286
by: Gary Kahrau | last post by:
How do I programatically apply a click to a particular row and column 0 of a datagrid? I want to do this in code as if the user did a mouse click on the leftmost column. ----------------------------------------------------------- Gary Kahrau
3
2882
by: Iosy | last post by:
Hi all, I'm working in a application where I need to detect when the mouse is inactive outside my form. I mean, I want to detect if the mouse hasn't move in the last X seconds (2 por example) and in case that it hasn't, show a menu. Thanks
4
7893
by: konafreeride | last post by:
Hello, Does anyone know of how I can go about suppressing a mouse click after I've handled it? I know this can be done for keystrokes via the Handled property, but I am unable to find a way to do so for mouse events.
5
2397
by: moonie | last post by:
I have an msn style c# windows application with a form and panel on it. A news list is drawn from the database and dynamically added via labels, link lables during form loading. In this application at run time this list should be generated again as the filtering criteria changes. So I clear the controls(labels) on the panel, get the list from the database and generate the list again. The list is created and it works fine. But sometimes...
3
1819
by: =?Utf-8?B?SmVycnk=?= | last post by:
I have the following code and it returns the x and y coordinates in the text box, but when I click the mouse on say 362,61 does not bring up form2.Any suggestions? Thanks, Jerry Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick Dim mouseX As Integer = e.X Dim mouseY As Integer = e.Y
0
1463
by: johnmcpherson1 | last post by:
What's the best method for detecting a ctrl key being depressed simultaniously with a right mouse click in a datagrid in a vb application? I need to get row, field resolution. Regards, John
6
1316
by: charvi | last post by:
hi is there any ascii code for mouse click this is because i have atext box and a list box.when i enter two letters in the text box all the related names will appear in the list box i want to select the name either by using arrow keys and enter key or by mouse click i was possible to code for arrow keys and then when i press enter key the names will appear in text box and list disappears.but when i use mouse click the name will appear in...
4
5907
by: APmore | last post by:
Hi, I am using windows(XP). In C, we can use scanf statement to accept any character. I want to accept only mouse click as input. How can I do in C?
0
9594
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
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
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...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.