I think I am going stupid.
 I am trying to databind a checkboxlist using entity framework 4.0 and Winforms 
(in vs2010)
 
The database looks like
 
Student                
                StudentID 
                StudentName
 Strengths
                StrengthID 
                 Desc
 StudentStrenghts
                StudentStrenghtID
                StudentID
                StrengthID                          
 
 What I want to do is display a form that will allow for selecting and 
displaying a student’s strengths.
 
I can bind the checkboxlist to show all StudentStrengths  - but I can’t get it 
to check the selected ones.
(this is not the actual code – just an example )
 
    Dim dc As New StudentEntities 
    Dim studentEntity = dc.Students.where(function(x) x.StudentID = 
1).SingleOrDefault
 
     Me.CheckedListBox1.DataSource = dc.StudentStrenghts
     Me.CheckedListBox1.DisplayMember = "Desc"
 
       Me.CheckedListBox1.DataBindings.Add(New Binding("SelectedValue", 
studentEntity.StudentStrengths ," StudentID"))
 
I am thinking it is because the items in the checkboxlist are Strengths, but 
the binding is to StudentStrenght, but I have tried everything and just need 
help.
 
Thanks.
 
 
                                          

Reply via email to