Solved

disable highlighting of listbox selection

Posted on 2004-09-03
3
473 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

856 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