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. Image for the cookie policy date
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:





2286 Dec 31,2002 07:06 AM UTC Jan 9,2003 04:47 AM UTC WinForms 2
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);

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

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon