Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
else if(dt.Rows[7]["Titel"].ToString() == "")//dt.Rows[7]["Titel"] = is equal to ""
               {
               labelEventi8.Visible = false; // This label get invisible
               linkLabelEventi8.Visible = false; //this label do not get invisible
               }


The problem is even both of them should be invisible you can still see the second label and that's weird.

What I have tried:

else if(dt.Rows[7]["Titel"].ToString().Equals(""))

else if(dt.Rows[7]["Titel"].ToString() == string.Empty


I put a breakpoint to see what the result of dt.Rows[7]["Titel"].ToString() is and saw that is ""
Posted
Updated 9-Jun-21 1:28am
Comments
Richard Deeming 9-Jun-21 7:19am    
Something else in your code is changing the visibility of one of the labels. You need to debug your code to find the code that's doing that.

We cannot debug your code for you.

1 solution

We can't tell - this requires your code running with your data and we don't have access to either of those.

So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900