Re: character string matches a speified patern(LIKE 'c%' )in DataV

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Shameer CK (shameerck_at_gmail.com)
Date: 10/12/04


Date: Mon, 11 Oct 2004 21:21:05 -0700

Try This.

DataView1 is a dataview filled with data
txtSearch is the textbox containing string to search for
DataGrid1 is the datagrid to which the DataView1 is attached

DataView1.Sort="FieldName";
//"FieldName" is the field in which the search will take place
int i=DataView1.Find(cmbSearch.Text);
if(i>DataView1.Table.Rows.Count || i<0)
{
MessageBox.Show("Record Not Found.");
}
else
{
DataGrid1.CurrentCell=new DataGridCell(i,1) ;
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!