c#

Nicedreamsbt

Lifetimer
Joined
Aug 30, 2007
Messages
269
Reaction score
0
Points
16
I am trying to get the information from a object in my combobox but its not working. Here is my code. I am using entity framework 6.0 and trying to make a flash card program.

private void button1_Click(object sender, EventArgs e)
{
using (fCardsEntities context = new fCardsEntities())
{
Book book = (Book)cmbBooks.SelectedItem;
context.Cards.Add(new Card { Chapter = textBox1.Text, BookId = book.Id });
context.SaveChanges();
}
 
I’m on a plane at the moment so can’t help, but you still need to provide more information. At a minimum we need an error message but in this situation you probably need to provide more source code as well.

At this point I have no idea what is not working for you.
 
It's ok I posted that quick also because I was so short on time working on a finals project at work. I wonderful getting that part working. I was trying to make a flash cars program using Windows forms and entity framework. I was able to populate a combobox with my books table and have the selected book populate and listvox with chapters but I got stuck because i think either my query was wrong or my database was not made correctly for the fk. Either way I turned in what I have and I am upset with myself because I know I could of done better but I was not able to work on it much this weekend because my gf was fighting with me. I am going to finish my project on my own over the break because I really enjoyed using the entity framework and what can be done with it. I appreciate the help btw. I know a lot of good coders are here and I always run here when I need help.