Results 1 to 5 of 5

Thread: [RESOLVED] [1.0/1.1] true doesn't equal true?

  1. #1

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Resolved [RESOLVED] [1.0/1.1] true doesn't equal true?

    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.
    Code:
    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 window
    Code:
    lvwSearch.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?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [1.0/1.1] true doesn't equal true?

    Put a breakpoint on the if() line and then check the variables.

  3. #3

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: [1.0/1.1] true doesn't equal true?

    I've tried this already. I just can't get to the bottom of it.

  4. #4
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [1.0/1.1] true doesn't equal true?

    Have you try using .Text.Equals("CheckOutID") ?

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

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  5. #5

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: [1.0/1.1] true doesn't equal true?

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width