Click here to Skip to main content
Rate this: bad
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
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.
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 Sergey Alexandrovich Kryukov 434
1 OriginalGriff 380
2 CHill60 240
3 Abhinav S 220
4 CPallini 220
0 Sascha Lefévre 75
1 OriginalGriff 70
2 F-ES Sitecore 55
3 Peter Leow 50
4 Dave Kreskowiak 40

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 24 Apr 2013
Copyright © CodeProject, 1999-2015
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