We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataView.Find() - how to search an item with wildcard?

Thread ID:

Created:

Updated:

Platform:

Replies:

2286 Dec 31,2002 07:06 AM UTC Jan 9,2003 04:47 AM UTC WinForms 2
loading
Tags: FAQ
Sergey P
Asked On December 31, 2002 07:06 AM UTC

DataView.Find() look for an item exactly: MyDataView.Sort="FirstName"; strFind="Nick" int nFind = MyDataView.Find(strFind); If strFind will be like "Nic" - search failed What to do?

Administrator [Syncfusion]
Replied On January 8, 2003 09:06 AM UTC

You can cheat and use a RowFilter on the view to look up all rows that start with a string, and then do an eact search. This does cause a flicker as the DataTable is filtered and quickly restored.
private void button1_Click(object sender, System.EventArgs e)
{
	DataView dv = this.dataSet11.Customers.DefaultView;
	dv.RowFilter = "[ContactName] LIKE 'B*'";
	string s = "";
	if(dv.Count > 0)
	{
		s = dv[0]["ContactName"].ToString();
	}
	dv.RowFilter = "";
	if( s != "")
	{
		int i = this.dataSet11.Customers.DefaultView.Find(s);
		Console.WriteLine(i.ToString());
	}
}

Sergey P
Replied On January 9, 2003 04:47 AM UTC

Thank you! It may be done using Datatable.Select

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;