Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

receive values from a listbox

$
0
0
I am trying to receive  values from a listbox and make a string which separates the items by ","
The following code does the job, but instead of the items, i get "System.Data.DataRowView" over and over.
Here is my code:

string[] items = listBox1.Items.OfType<object>().Select(item => item.ToString()).ToArray();
string result = string.Join(",", items);
label1.Text = result;

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>