Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 combobox
I need to get read a deselect text from a full text in a combobox where some text are selected.
 
Suppose the searching text is emergency where emer is not highlighted but gency is highlighted.
So I need to read this deselect text emer to perform operation.
 
Help me plz.Thanks in advance.
Posted 23-Apr-13 20:34pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Also a ComboBox has a SelectionStart and a SelectionLength property. Hence you can work with Text.Substring and get the parts of the text you need.
  Permalink  
Comments
Member 8454009 at 24-Apr-13 10:15am
   
textbox2.Text = textbox1.Text.Substring(textbox1.SelectionStart, textbox1.SelectionLength);
 
I am in trying. But this code is not working. Please any solution in this problem.
Bernhard Hiller at 25-Apr-13 2:23am
   
C'mon - your code does exactly the opposite: it gets the selected text. Actually I'd expected also a beginner to test e.g.
textbox1.Text.Substring(0, textbox1.SelectionStart) and textbox1.Text.Substring(textbox1.SelectionStart + textbox1.SelectionLength);
or combinations thereof...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 195
1 Afzaal Ahmad Zeeshan 132
2 ProgramFOX 130
3 Maciej Los 115
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,657
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 24 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100