How to load a listbox with nothing selected

Posted on 2011-03-01
Medium Priority
Last Modified: 2012-05-11
How can I load a listbox and not have the first line highlighted/selected.  Thanks
Question by:running32

Expert Comment

ID: 35011268
Change the focus of the form to a different control. So set it to


Open in new window

I believe the listbox won't show selection if it is not selected. You can even set focus to the form or page.

Author Comment

ID: 35011350
No that doesn't seem to work

Accepted Solution

PagodNaUtak earned 2000 total points
ID: 35013765
After loading the items in the listbox execute this line of code:
listbox1.selectedindex = -1

Open in new window

LVL 19

Expert Comment

by:Shahan Ayyub
ID: 35018496
Another alternative can be:

Control SelectionMode property of ListBox.

Private Sub Form2_Load(sender As Object, e As EventArgs)
	listBox1.SelectionMode = SelectionMode.None
End Sub

Private Sub listBox1_MouseClick(sender As Object, e As MouseEventArgs)
	listBox1.SelectionMode = SelectionMode.One
End Sub

Open in new window


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…

607 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