I'm trying to get a simple card game to work ... and I'm getting an "Impossible to cast " error ... but I'm not trying to cast anything ... I'm a little confuse about why I get this error. Heres a quick summary of the 3 object I use.
Public Class Holder
inherits Panel
end class
Public Class Card
inherits PictureBox
end class
public Class Location
Public Property X as integer
Public Property Y as integer
end class
Public Class Board
inherits Form
Public Property Tile as Dictionnary(of Location, Holder)
Public sub PlayCard(card as Card, loc as Location)
Tile(loc).Controls.Add(card)
end sub
end Class
and I get an InvalidCastException:
Impossible to cast objet type 'Holder' in Type 'Card'.
I've triple check to make sure its really a card thats being pass as a parameter to the PlayCard sub .... and I get no idea what to do from here ...
any suggestions ?
EDIT :
Private Sub TEST() Handles Board.Load
Dim c = New Card
Dim p1 As Location
p1 = New Location(2, 1)
c.Image = My.Resources.Tree
Me.Play(c, p1)
End Sub