Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2009, 07:58 AM
Authorized User
 
Join Date: Aug 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Double Clicking The Blank Area of a ListBox

Hi all

I have created a listbox in a userform which the user can double click on to drill down in to the detail behind their chosen record.
Noramlly the list will contain hundreds on records so the listbox window I have created fills most of the screen. I am happy with this view and I have provided tools on the form that can filter and sort the displayed list so that the user is not overwhelmed. So far, so good.

My problem is that when the list has been filtered down to only a few remaining items (e.g. 3) then most of the bottom area of the list box area will be blank. Now when they single click on a record, that record becomes highlighted. If they then double click in the blank area at the bottom of the listbox below the few remaining filtered items, the highlighted item is used in the beforedoubleclick event. This might not be what was intended.

I would prefer that clicking in the blank area of the listbox deselects the previously selected record (using .listindex = -1 perhaps) so that my existing code can ignore this kind of double click.
How can i deselect the item when the user double clicks in the blank area? Is this possible or should I just avoid this approach by perhaps using a button below the listbox to drill down instead?

Many thanks in advance for you help on this...
Reply With Quote
  #2 (permalink)  
Old December 4th, 2009, 10:42 AM
Authorized User
 
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Use a button or perhaps post this in the appropriate forum as this forum is for Visual Basic 6.0 and not .NET



Good Luck
Reply With Quote
  #3 (permalink)  
Old December 4th, 2009, 10:04 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

It would be really good if you can filter the blank records before they are loaded to Listbox probably by a where clause in query etc

If it can;t be done, you can check for the selected text and delete the record. But it is a tedious process

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #4 (permalink)  
Old December 11th, 2009, 10:15 AM
Authorized User
 
Join Date: Aug 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by vb5prgrmr View Post
Use a button or perhaps post this in the appropriate forum as this forum is for Visual Basic 6.0 and not .NET



Good Luck

Hi
I am using VBA (VB6.5) to run these user forms within Excel but I suspect you are right and that I am forced in to using a button.
The only other alternative I could come up with is to resize the listbox to be smaller so that the empty space isn't displayed, thereby doing away with the problem. However, that would make the rest of the form look weirdly empty and I don't want to have to resize the whole form as there are too many other controls on it to worry about.
I think I'll do as you say and stick with the button.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double clicking control does not add code to Code Behind Paul Walton BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 September 25th, 2009 05:40 PM
Expanding TreeView from double clicking ListView maxl Pro Visual Basic 2005 1 March 5th, 2007 12:54 PM
Get coordinates from clicking in a area eresina HTML Code Clinic 3 July 11th, 2005 11:25 AM
Clicking on a datagrid header badgolfer ASP.NET 1.0 and 1.1 Basics 1 November 5th, 2004 03:42 PM
disable clicking in JTable noman77 Java GUI 0 October 18th, 2004 02:36 AM



All times are GMT -4. The time now is 06:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.