Click here to Skip to main content
13,254,754 members (51,833 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I want to populate a listbox from databse while values in databse are comma separated.
I have values in the table columns like this "fever, cough".

Please guide me as to how I can populate these items in listbox?
I intend to populate in such a way that each item should appear in separete row in the listbox.

Thanks in Advance
Posted 11-Jan-11 22:49pm
Updated 12-Jan-11 0:02am
Dalek Dave433.3K
Dalek Dave 12-Jan-11 5:02am
Edited for Readability.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can split the comma seperated values into a string array and you can assign the array as a DataSource to the ListBox.

For example:

string commaSeperatedData = "data1,data2,data3";
ListBox1.DataSource = commaSeperatedData.Split(',');
Dalek Dave 12-Jan-11 5:02am
Good Answer.
Espen Harlinn 12-Jan-11 5:22am
5+ Nice and easy, no fuss

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100