PDA

Click to See Complete Forum and Search --> : [RESOLVED] [1.0/1.1] true doesn't equal true?


Fishcake
Mar 19th, 2007, 10:24 AM
It's been a while since I've coded desktop apps but this has really got me confused.

I have an if statement that I can't get in to.if(lvwSearch.Columns[lvwSearch.Columns.Count-1].Text == "CheckOutID")
{
string test = "Why can't i get here!";
} I know that the text of the column is "CheckOutID" and I can even confirm this in the immediate windowlvwSearch.Columns[lvwSearch.Columns.Count-1].Text
"CheckOutID"
lvwSearch.Columns[lvwSearch.Columns.Count-1].Text == "CheckOutID"
true
Yet the if statement doesn't seem to equate it to true and won't execute code contained within.

Any idea's?

penagate
Mar 19th, 2007, 10:35 AM
Put a breakpoint on the if() line and then check the variables.

Fishcake
Mar 19th, 2007, 11:34 AM
I've tried this already. I just can't get to the bottom of it.

Jumpercables
Mar 20th, 2007, 04:27 PM
Have you try using .Text.Equals("CheckOutID") ?


if(lvwSearch.Columns[lvwSearch.Columns.Count-1].Text.Equals("CheckOutID"))
{
string test = "Why can't i get here!";
}

Fishcake
Mar 21st, 2007, 05:42 AM
Thanks for your suggestions. However it seems it was just 'one of those things'. I removed the class from my project, added a new class and copied all the code into it and it worked.

Perhaps it was just corrupt in some way?