---
title: "ListBox Control in VB.Net"  
description: "The ListBox control displays a list of items from which we can make a selection. We can select one or more than one of the items from the list.Drag"  
author: "Pushpendra Singh"  
published: 2010-12-11  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/303/listbox-control-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# ListBox Control in VB.Net

\

The [ListBox control](https://www.mindstick.com/articles/395/listbox-control-in-c-sharp-dot-net) displays a list of items from which we can make a selection. We can [select](https://www.mindstick.com/forum/34066/use-select-operator-in-linq) one or more than one of the items from the list.

[Drag and drop](https://www.mindstick.com/forum/454/how-to-drag-and-drop-multiple-image-from-one-canvas-to-onther-canvas-in-html5) ListBox from toolbox on the [window Form](https://www.mindstick.com/forum/527/how-to-pass-datagridview-s-cells-value-to-another-window-form).

![ListBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/35d84ede-e970-4c74-98db-a64b64d3265f/images/0a3564b5-87b5-440e-bd2c-4df830682fec.png)

## Code:

```
Public Class Form8      Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles MyBase.Load         'Item is added in ListBox         ListBox1.Items.Add("C#")         ListBox1.Items.Add("J#")         ListBox1.Items.Add("VB")         ListBox1.Items.Add("Java")     End Sub       Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles ListBox1.SelectedIndexChanged         'selected option will show in Label using the selected item property        Label2.Text = "Selected Language is  " + ListBox1.SelectedItem     End SubEnd Class
```

In above code Item is added dynamically so all Item in ListBox1 will show at run time.

**Run the [project](https://yourviews.mindstick.com/story/1788/things-to-ensure-your-construction-project-is-successful)**

![ListBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/35d84ede-e970-4c74-98db-a64b64d3265f/images/7f0b5722-fdcc-46d1-a1f1-1db764918af7.png)

When you select given option then SelectedIndexChanged event will fire and selected Item will show in the Label.

![ListBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/35d84ede-e970-4c74-98db-a64b64d3265f/images/62584502-8f76-4ca0-82a5-7dd82de10d3c.png)

**ListBox Control [Properties](https://yourviews.mindstick.com/view/81845/now-it-s-possible-to-predict-properties-of-any-molecule)**

## Sorted:

ListBox can be sorted through ListBox sorted [Property](https://www.mindstick.com/articles/198559/an-ownership-of-property-in-hua-hin)

```
Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         ' sorted ListBox Item          ListBox1.Sorted = True    
```

![ListBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/35d84ede-e970-4c74-98db-a64b64d3265f/images/fbbb6e7b-9202-4604-b9a6-fc9f83f543c6.png)

ListBox Item is sorted.

## BackColor:

ListBox Color can be changed through ListBox BackColor Property

```
Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         'change ListBox BackColor         ListBox1.BackColor = Color.LawnGreenEnd Sub
```

ListBox BackColor will be change when Application Run.

![ListBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/35d84ede-e970-4c74-98db-a64b64d3265f/images/81b18f00-58a2-49a5-9c0c-92d2e21a039c.png)

## ForeColor:

ListBox Fore color is changed through ListBox ForeColor Property.

```
Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         'change ListBox ForeColor         ListBox1.ForeColor = Color.RedEnd Sub
```

ListBox Fore color is changed at run time.

![ListBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/35d84ede-e970-4c74-98db-a64b64d3265f/images/1cf63bcf-a0fb-4c38-ba45-e8276b7be4dc.png)

---

Original Source: https://www.mindstick.com/articles/303/listbox-control-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
