I think i got out of bed the wrong side.... My issue, i have a graphics object and i need to remove an item named "YearClock" before it is relaced with a new value.

My code
VB.Net Code:
  1. For Each i As Canvas In cnvYearClock.Children
  2.     If i.Name = "YearClock" Then
  3.         cnvYearClock.Children.Remove(i)
  4.     End If
  5. Next
  6. cnvYearClock.Children.Add(newCanvas)
when run i get an error that one of the other items contained in this object is not of type Canvas. now what is wrong with this? shouldn't this loop return only items of type canvas and ignore all other types?