Click here to Skip to main content
13,797,212 members
Rate this:
Please Sign up or sign in to vote.
the user should be able to select multiple values from CheckedListBox or ListBox and when the user click 'Save', the record should be inserted in a single column of a table.
I need code.
plz helppp
Posted 5-Apr-10 22:27pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Is this what you are looking for?

I created a DataTable, added a single column and filled it with a for loop going through all the Selected Items of a ListBox.

DataTable dt = new DataTable();

for (int i = 0; i < listBox1.SelectedItems.Count; i++)

dataGridView.DataSource = dt;
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You insert rows into a database table, not columns.

You can loop over the selected items in your (Checked)ListBox and insert a row for each item, setting the same column in each row. I don't know if that is what you want.


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 | Cookies | Terms of Service
Web04 | 2.8.181207.3 | Last Updated 6 Apr 2010
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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