Yes you are right, that was kind of obvious i guess. However i mostly tried that statement because i could not get anything else to work.
I just found the solution now. I had to set the AppendDataBoundItemsproperty
of the ListBox to True, aswell as removing the statement you pointed out.
Thanks for looking through my questions once again.
Edit: Here is another attempt in case someone is interested.
Using myEnt As New PicturesEntities()
Dim picCount = From tag In myEnt.Pictures
Order By tag.Id Descending
For Each li As ListItem In TagLB.Items
If li.Selected Then
Dim tg As New TagLink
Dim tx As ListItem = li ' (compiler complained when i used the iterator)
Dim tagsX = From tag In myEnt.Tags
Order By tag.Id
Where tag.TagName = tx.Text
tg.TagId = tagsX.First
tg.PictureId = picCount.FirstOrDefault + 1