I am trying to hide all my images i currently have on my WPF using this code below:
Dim theImgs() As Controls.Image = {picNextTopic1, picNextTopic2, picNextTopic3, picNextTopic4, picNextTopic5, picNextTopic6, picNextTopic7, picNextTopic8, picNextTopic9, picNextTopic10, picNextTopic11, picNextTopic12, picNextTopic13, picNextTopic14, picNextTopic15, picNextTopic16}
Dim intX As Integer = 0
Do Until intX = theImgs.Length
Try
theImgs(intX).Visibility = Visibility.Hidden
intX += 1
Catch ex As Exception
MsgBox(ex.Message)
End Try
Loop
However, when running the code above i get this error:
The calling thread cannot access this object because a different thread owns it
How can i fix this error?