Question

How to check if a label is visible?This is not working...

   if(labelFS.Visible = false)
        {do sth}
   else//labelFS.Visible = true
        {do other}

solved

Was it helpful?

Solution

Use == to compare two values, not the assignment operator (a single =).

By using a single =, you're actually setting the value of labelFS.Visible to False, which hides it.

(There's also no need to type out true and false .)

if (labelFS.Visible)
    // do something
else
    // do something else

I'd suggest reading up on the difference. Here's a start...

OTHER TIPS

if(labelFS.Visible == false)
        {do sth}
   else//labelFS.Visible == true
        {do other}

Use == instead of =

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top