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

bUseRegex in EditControl.Find

Thread ID:





21148 Nov 3,2004 12:17 PM UTC Nov 4,2004 02:08 PM UTC WinForms 1
Tags: EditControl
Asked On November 3, 2004 12:17 PM UTC

The editcontrol function ''Find'' specifies an option for bUseRegex. I set it to true and set my ''str'' parameter to a regular expression, but get not results. Can I get some examples of using the Find function with regex.

Administrator [Syncfusion]
Replied On November 4, 2004 02:08 PM UTC

Hi Willaim Here is a sample code snippet that you can add to any of the Essential Edit samples that ship: private void button1_Click(object sender, System.EventArgs e) { Regex rg = new Regex("&\\w{1,}"); string searchstr = (rg.Match(this.editControl1.GetString(this.editControl1.CurrentLine)).Value); if (searchstr=="") { MessageBox.Show("No Text matching the pattern found in Line: " + this.editControl1.CurrentLine.ToString()); } Syncfusion.Windows.Forms.Edit.EditLocationRange range = editControl1.Find(new Syncfusion.Windows.Forms.Edit.EditLocation(this.editControl1.CurrentLineChar.L,this.editControl1.CurrentLineChar.C),searchstr,false); this.editControl1.Select(range); this.editControl1.Focus(); } The thing to note is that you need pass the string that you want to find when you use the EditControl''s Find method. In this case it locates it finds a word beginning with a & in a particular line (like say &test). Regards Arun


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