Solved

disable highlighting of listbox selection

Posted on 2004-09-03
3
472 Views
Last Modified: 2008-02-01
I have a group of listboxes that a user selects items from. Normally you select an item from a listbox and the item becomes highlighted blue, click it again and the highlighting is disabled. Is it possible to disable the highlighting, or as the item is selected remove the highlighting.
Also when a user holds down the spacebar in a listbox,all consecutive items are selected, can this be prevented.
0
Comment
Question by:dearness
  • 2
3 Comments
 

Accepted Solution

by:
vb6wizard earned 250 total points
ID: 11975736
I am not entirely sure what programming language you are using but I will answer it from the Visual Basic point of view.  You want to immediately disable the highlighting of an item as soon as it is selected.  The code that I am putting below will do this in Visual Basic.  A few things to note -- the name of the object is List1 so you will need to change this to the name of the object that you are using.  This code is also placed in the Click Method.  I will post some more details later.
Private Sub List1_Click()
  If List1.ListIndex >= 0 Then
      If List1.Selected(List1.ListIndex) = True Then
          List1.Selected(List1.ListIndex) = False
      End If
  End If
End Sub
0
 

Author Comment

by:dearness
ID: 11978855
vbWizard,
sorry for not giving the programming language, but you were right on target. Your suggestion works great. Nice simple answer.
Thanks.
0
 

Author Comment

by:dearness
ID: 11978858
By the way, I had one of the list boxes set for multi select, thats why the spacebar was selecting consecutive items
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question