Click here to Skip to main content
15,119,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add listbox items to a database table. But I want to add those listbox items to different columns in a single row based on the condition. How to do?
Any help is appreciated.

What I have tried:

I added all those listbox items to a datatable and I created userdefined datatable type to insert those values.
I did upto here. I don't what to do next
Posted
Updated 2-Aug-18 3:44am
Comments
Richard MacCutchan 1-Aug-18 3:34am
   
Read all the items from the listbox, and write them to the database. What is the difficulty?
Mike V Baker 1-Aug-18 8:34am
   
We can't tell from this where you're having the problem. You need to tell us where your problem is and post some *relevant* code.

1 solution

If you want to use multiple columns of data don't use a ListBox, use a ListView instead.

Here is the documentation for it ... ListView Class (System.Windows.Forms)[^]

You will want to use the "Details" view

Here is an example: C# ListView Control[^]
   

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900