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
close icon

SelectedText

Hello, I have an edit control that I check to see if there is selected text. If I actually select text it works fine, but I have a problem when I don''t select any text. My text has some carriage returns and new lines. If I have three lines that each have a carriage return at the end I always get the line where the cursor is as the selected text. This happens even though I have no text selected. For example: Line 1\r Line 2\r Line 3\r If my cursor is in line 1 with nothing selected the SelectedText is Line 1\r. Is there something I''m doing wrong? Thanks, Nick

2 Replies

AD Administrator Syncfusion Team May 25, 2004 04:14 PM UTC

Hi Nick This seems to be due to the CopyWithoutSelection property in Essential Edit (similar to VS.NET). This behavior should go away when you set this property to false but it does not. You could work around this by checking the HasSelection property: if(this.editControl1.HasSelection) { MessageBox.Show(this.editControl1.SelectedText); } I am uploading a sample. Kindly take a look and get back to us if you have any further questions. Regards Arun


NH Nick Howard May 25, 2004 04:57 PM UTC

Thanks Arun. It works great now. I appreciate your help. >Hi Nick > >This seems to be due to the CopyWithoutSelection property in Essential Edit (similar to VS.NET). This behavior should go away when you set this property to false but it does not. > >You could work around this by checking the HasSelection property: >if(this.editControl1.HasSelection) >{ > MessageBox.Show(this.editControl1.SelectedText); >} > >I am uploading a sample. Kindly take a look and get back to us if you have any further questions. > >Regards >Arun >

Loader.
Live Chat Icon For mobile
Up arrow icon