Link to home
Start Free TrialLog in
Avatar of InfoTechEE
InfoTechEE

asked on

C# DataGridViewRow

I am trying to see if a cell inside my DataGridViewRow contains a certain word -- "TFT".

if (row.Cells["Case Name"].Value.Equals("TFT")) // works great at checking if it equals the word I'm looking for, but I need to check for "contains" not "equals". How would I go about doing that?

The equivalent of what I'm looking for in SQL would be: WHERE CaseName like '%TFT%'
Avatar of masterpass
masterpass
Flag of India image

Why don't you just use the contains ?!!!

try like this

if (row.Cells["Case Name"].Value.Contains("TFT"))

Open in new window

Avatar of InfoTechEE
InfoTechEE

ASKER

It says object does not contain a definition for Contains. Also, I don't see it as an option after:

if (row.Cells["Case Name"].Value.
ASKER CERTIFIED SOLUTION
Avatar of Vikram Singh Saini
Vikram Singh Saini
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial