Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27405

[RESOLVED] Question about the tag property

$
0
0
I've never really used the tag property, but I've decided to try and use it. My senario: based on if a boolean value(playerturn) I set the tag property:

Code:

        Dim pnl As Panel = CType(sender, Panel)

        With pnl
            .BackgroundImage = createPlay()
            .Enabled = False
        End With

        If playerTurn Then
            playerTurn = False
            pnl.Tag = "player"
        Else
            playerTurn = True
            pnl.Tag = "cpu"
        End If

My issue is when I try to compare the tag. I try to here:
Code:

        If Panel1.Tag = "player" Then

        End If

I throws an error:
Quote:

Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for object identity.
but I'm not to sure how to do that. I know I've seen that error before, but I was able to use CType to clear that up.

Viewing all articles
Browse latest Browse all 27405

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>