Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

C# Or Operator Problem

$
0
0
I am having a problem where i am trying to check if two label values are equal too null. One of the labels is null and the other contains a string value. The code i have seems to only check if one of the labels is empty and not the other.
heres the statement in question
if (string.IsNullOrEmpty(Lbl1.Text) || string.IsNullOrEmpty(Lbl2.Text))
            {
               messagebox.show("Boxes Empty");
            }
            else
            {
              messagebox.show("Boxes not empty");
            }


Can anyone see why it would not be hitting the else if Lbl2 has a value.

Thanks Inkey

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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