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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Previously recognised keyword

Thread ID:





94399 May 11,2010 09:48 AM UTC May 13,2010 08:33 AM UTC WinForms 3
Tags: EditControl
Scott Blood
Asked On May 11, 2010 09:48 AM UTC


I am currently evaluating your .net controls for use in our products.

I am having difficulty finding out how to get the last identified keyword in the Edit control from the current cursor position.

For example, if a user enters the following SQL code into the editor control.

Select Field1, Field2, Field3 from MyTable

And then positions the cursor within the MyTable text, i would expect a function to return the FROM keyword or if the user placed the cursor in the Field2 text, i would expect this to return SELECT.

Could you point me to the correct way of doing this.

Unfortunately i am unable to download any attatchments in work, so if you could post the code here this would be very much appreciated.


Karikalan Natarajan [Syncfusion]
Replied On May 12, 2010 10:38 AM UTC

Hi Scott,

Thanks for your interest in Syncfusion products.

Please find the following sample link which illustrates “Previously recognized keyword”.


The sample code as follows.

void editControl1_CursorPositionChanged(object sender, EventArgs e)
ILexemLine line = this.editControl1.GetLine(this.editControl1.CurrentLine);

//Read all lexems in line
IList listofLexems = line.LineLexems;

//read current word(lexem)
ILexem currentLex = line.FindLexemByColumn(this.editControl1.CurrentColumn);

//If current word is select or from, it return.

string returnStr = string.Empty;

foreach (Lexem lex in listofLexems)
if (lex.Column > currentLex.Column)
if (lex.Config.Format.Name == "KeyWord" && lex.Column < currentLex.Column)
returnStr = lex.Text;

if (returnStr != string.Empty)
Console.WriteLine("ReturnStr:" + returnStr);
MessageBox.Show("Keyword is:" + returnStr);


Please let me know if you need further assistance.

Karikalan N

Scott Blood
Replied On May 12, 2010 01:02 PM UTC


Thanks for your post. However i have an issue with this code.

Firstly, the code only searches on the currently line for the last identified keyword, what if the user is on another line??? have do i ensure that the search goes backwards to the last found keyword, regardless of what line the user is on.

Secondly you actually have helped me by pointing me in the direction of a nasty bug i had implemented and not thought of, if a user is currently over a keyword, you dont want the system popping up intellisense for the previous keyword, so thankyou very much for this.

If you could help me a little further i am sure within the near future i will be putting an order in for a number of licenses for your complete component suite.

Karikalan Natarajan [Syncfusion]
Replied On May 13, 2010 08:33 AM UTC

Hi Scott,

Thank you for your inquiry. We appreciate the opportunity to assist you.

Here is the sample application which illustrates your expected behavior "the search goes backwards to the last found keyword"


In the sample, if a cursor is in start of the word or within the word, the search goes backwards to last found keyword like Select,from,etc.,

Please post the queries in Direct-Trac. You will get a faster response along with an automatic update when your question is answered via Direct-Trac. We are happy to assist you.

Here is the Direct-Trac link.


Please let me know if you need further information on this.

Karikalan N


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