Click here to Skip to main content
13,048,584 members (79,340 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 19: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 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 24 Apr 2013
Copyright © CodeProject, 1999-2017
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