Hi all,

I am trying to write a code that could show multiply values in a single cell of listview with comma separator... i am using C# with windows application...

I have a attachment that show what i am asking for...

Thanks in advance

Recommended Answers

All 6 Replies

Did you tryed to join all the values in a string, then use it to fill the list view subitem?


string thetextToShowInTheCell="";
foeach(string valueToshow in ListOfStringValuesToShowInTheCell){
    if (thetextToShowInTheCell.Length>0) thetextToShowInTheCell+=", ";
    thetextToShowInTheCell += valueToshow; }

Hope this helps

I tried that method .. but it is showing ArgumentOutOfRange expection...

And it also shows erros as "can not insert value in this position. Remove the previous value and insert or clone it"
I dont know why it is asking to clone the values to be shown...????

Any other methods..???

thanks for replying.

Hello Vince,

Here you go.

ListViewItem lvi = new ListViewItem( new string[] {"1", "2", "3", "4"});

Let me know if you succeed.


Sorry, miss read your question. Here is the new better code.

string[] list = { "1", "2", "3", "4" };  

string all = String.Join(",", list);

ListViewItem lezen = new ListViewItem( new string[] { all, "2", "3", "4"});

Can you be so kind to show your current code?


After this peace of code there is only one line:


Hope this helps.

Thanks all for ur replies... i have used lola's idea and Three idea to get the desired output.. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.