1
Reply

How to use Array.IndexOf() to search a column in a datatable

Ray Sotkiewicz

Ray Sotkiewicz

Jan 2 2011 2:24 AM
1.9k

I want to search a column in a datatable for a specific value.
In a separate loop I have:

if
(ContainsViaIndex(dataconfig.data.Tables[0].Columns[1], Device0Loop))
{
      
MessageBox.Show("HOLY CRAP!!");
}

And then...

public
static bool ContainsViaIndex(DataObject data, int value)
{
     
return Array.IndexOf(data, value) > -1 ? true : false;
}

My problem (Total noob at this), is how to define what "DataObject data" is...
I am getting the following error in my compiler:
Error 2 Argument '1': cannot convert from 'System.Data.DataColumn' to 'System.Windows.Forms.DataObject' D:\Joystick to FSUIPC converter\TestConsoleForm.cs 672 41 UIPC_SDK_CSHARP
So.. what kind of 'type" should I use?

 
 
 
 

Answers (1)