Im struggling with some entity framework stuff.
I have this code :
if (LsbSsd.SelectedIndex != -1)
{
Csharppcbuilder.Artikelen artikel = Database.pe.Artikelen.Where(x => x.Naam == LsbSsd.SelectedItem.ToString()).FirstOrDefault();
databank.DeleteArtikel(artikel);
}
My problem is that everything gets added to the other listbox and it does exactly what i want, but i cant seem to deselect items when i've added them to the other listbox.
What i've tried :
if (LsbSsd.SelectedIndex != -1)
{
Csharppcbuilder.Artikelen artikel = Database.pe.Artikelen.Where(x => x.Naam == LsbSsd.SelectedItem.ToString()).FirstOrDefault();
databank.DeleteArtikel(artikel);
LsbSsd.SelectedIndex = -1;
}
Hope someone can help me out.
edit : if someone needs more context i can provide it
LsbSsd.SelectedItem = null;
? – MateuszLsbSsd.SelectedIndex = -1;
should work, and if it doesn't, something else is going on that we can't see. Check your other events. – LarsTech