Results 1 to 1 of 1

Thread: [RESOLVED] Can someone tell me what's wrong with this.

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Resolved [RESOLVED] Can someone tell me what's wrong with this.

    I'm using VS2010 C#4.0

    Code:
                               if (resultTable.Rows[i]["RISKADDRESS"].ToString().EndsWith(",") ? riskAddress =  resultTable.Rows[i]["RISKADDRESS"].ToString().Substring(0, resultTable.Rows[i]["RISKADDRESS"].ToString().Length - 1) : riskAddress =  resultTable.Rows[i]["RISKADDRESS"].ToString());
    it states that cannot implicitly convert from string to bool

    If I enter the above long hand i.e. with a full if else statement I receive no errors.

    If I take the first part
    Code:
    resultTable.Rows[i]["RISKADDRESS"].ToString().EndsWith(",")
    and wrap it in a Convert.ToBoolean or prefix with (Boolean), I still receive the error.

    The inline condition EndsWith needed to be ',' as opposed to ","
    Last edited by Bill Crawley; Feb 17th, 2011 at 05:40 AM.

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