Click here to Skip to main content
16,016,570 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to send data from one specific cell in the database to a checklistbox?

So when i click a row in datagridview, the items listed in cell 9 will go into the checklistbox


But when I check the checklistbox, its empty

What I have tried:

checkedListBox1 = this.CustOrdersDGV.CurrentRow.Cells[9].Value.ToString();


But i get an error of
CS0029  C# Cannot implicitly convert type 'string' to 'System.Windows.Forms.ChcekedListBox
Posted
Updated 13-Apr-18 4:17am
v7
Comments
Richard MacCutchan 13-Apr-18 8:59am    
What happens when you try it?
Member 13765884 13-Apr-18 9:23am    
Error message CS0029 C# Cannot implicitly convert type 'string' to 'System.Windows.Forms.ChcekedListBox
Richard MacCutchan 13-Apr-18 9:46am    
You need to understand that different object types are not all compatible.

And it is also not clear exactly what you are trying to do.
Member 13765884 13-Apr-18 10:27am    
So when i click a row in datagridview, the items listed in cell 9 will go into the checklistbox
Richard MacCutchan 13-Apr-18 10:33am    
A ListBox is a container that holds an Items collection. So you either use DataBinding to connect the two parts, or one of the methods in CheckedListBox Class (System.Windows.Forms)[^] to add the items each time you click the DataGridView row.

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