[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

C# DataGridViewRow

Posted on 2012-04-02
3
Medium Priority
?
477 Views
Last Modified: 2012-04-03
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%'
0
Comment
Question by:InfoTechEE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Expert Comment

by:masterpass
ID: 37798736
Why don't you just use the contains ?!!!

try like this

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

Open in new window

0
 

Author Comment

by:InfoTechEE
ID: 37798827
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.
0
 
LVL 16

Accepted Solution

by:
Vikram Singh Saini earned 2000 total points
ID: 37798985
Try

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

Open in new window


instead of

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question