---
title: "Hot to get value in label of Multi Selected Listbox?"  
description: "Hot to get value in label of Multi Selected Listbox?"  
author: "Samuel Fernandes"  
published: 2014-10-21  
updated: 2014-10-21  
canonical: https://www.mindstick.com/forum/2428/hot-to-get-value-in-label-of-multi-selected-listbox  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 2 minutes  

---

# Hot to get value in label of Multi Selected Listbox?

Hi\
\
How to get [listbox](https://www.mindstick.com/articles/626/listbox-events-in-c-dot-net) [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) selected [values](https://www.mindstick.com/forum/327/sum-textbox-values) in [label](https://www.mindstick.com/articles/12835/print-label-tracking-how-do-these-features-make-auspost-woocommerce-plugin-better) or [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp).\
I have [bind data](https://www.mindstick.com/forum/415/how-to-bind-data-in-windows-phone-7-using-wcf-service) from [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) in listbox then when i [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) multi values then this display in label or string\
when i try get values in label then display System.Data.Dataview multi time\
my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)\
\
for (i = 0; i < lstcsuspectcode.SelectedItems.Count; i++)\
{\
\
label18.Text = label18.Text + " " + lstcsuspectcode.SelectedValue;\
\
}

## Replies

### Reply by Mark Devid

##### HI Guys try this...

\
using System; using System.Collections.Generic; using System.ComponentModel; using System.[Data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science); using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; \
namespace WindowsFormsApplication6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } \
private void Form1_Load(object sender, EventArgs e) { listBox1.Items.Add("a"); listBox1.Items.Add("b"); listBox1.Items.Add("c"); listBox1.Items.Add("d"); } \
private void button1_Click(object sender, EventArgs e) { int i; for (i = 0; i < listBox1.SelectedItems.Count; i++) { \
label1.Text = label1.Text + " " + listBox1.SelectedItem.ToString(); \
} } } }

### Reply by Royce Roy

You can try this code.\
\
string s = "";\
foreach (ListItem li in ListBox1.Items) {\
\
if (li.Selected == true) {\
s = s +" "+ li.Value;\
}\
\
}


---

Original Source: https://www.mindstick.com/forum/2428/hot-to-get-value-in-label-of-multi-selected-listbox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
