TexationJobsEntities de = new TexationJobsEntities();
var operatives = from o in de.Operatives
selectnew {o.OperativeID, o.First_Name, o.Last_Name};
foreach (var operative in operatives)
{
operativesListBox.Items.Insert(operative.OperativeID, operative.First_Name + " " + operative.Last_Name);
}
Its very weird as the list box remains empty. but the following works fine (apart from the fact that the entries are not in sync with the source database)
C#
TexationJobsEntities de = new TexationJobsEntities();
var operatives = from o in de.Operatives
selectnew {o.OperativeID, o.First_Name, o.Last_Name};
foreach (var operative in operatives)
{
operativesListBox.Items.Add(operative.First_Name + " " + operative.Last_Name);
}
anyone have any ideas ?
Thanks in advnace
Regards
Ore
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Paul Chambers9 pointsPosted Oct 24, 2010, 2:52 AM EDT
0
Hi Suthish Nair,
Thanks for the replies. I tried the breakpoint previously and everything seemed to be working but the list box just remained blank.
I tried your second solution with a little bit of tweaking it seems to be working the way I want!!
Thanks for your help!
Suthish NairRank #93 · 22.6K pointsPosted Oct 23, 2010, 10:59 PM EDT
Suthish NairRank #93 · 22.6K pointsPosted Oct 23, 2010, 10:52 PM EDT
Paul Chambers9 pointsPosted Oct 24, 2010, 2:52 AM EDT
Thanks for the replies. I tried the breakpoint previously and everything seemed to be working but the list box just remained blank.
I tried your second solution with a little bit of tweaking it seems to be working the way I want!!
Thanks for your help!
regards