473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 5117

"Randy Harris" <pl****@send.no.spam> schreef in bericht news:wP*******************@newssvr14.news.prodigy. 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
ListBoxColumnResize.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*******************@newssvr14.news.prodigy. 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
ListBoxColumnResize.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*******************@newssvr14.news.prodigy. 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
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...
2
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...
3
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. ...
3
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)...
4
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...
5
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...
3
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...
0
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
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...
4
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.