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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:





2286 Dec 31,2002 02:06 AM Jan 8,2003 11:47 PM Windows Forms 2
Tags: FAQ
Sergey P
Asked On December 31, 2002 02:06 AM

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 04:06 AM

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);

Sergey P
Replied On January 8, 2003 11:47 PM

Thank you! It may be done using Datatable.Select


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.

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.