Click here to Skip to main content
15,921,660 members
Home / Discussions / C#
   

C#

 
GeneralIEndPoint Object Pin
dabuskol22-Jun-04 23:49
dabuskol22-Jun-04 23:49 
GeneralRe: IEndPoint Object Pin
Colin Angus Mackay23-Jun-04 0:33
Colin Angus Mackay23-Jun-04 0:33 
GeneralRe: IEndPoint Object Pin
dabuskol23-Jun-04 0:59
dabuskol23-Jun-04 0:59 
GeneralRe: IEndPoint Object Pin
Colin Angus Mackay23-Jun-04 1:19
Colin Angus Mackay23-Jun-04 1:19 
GeneralRe: IEndPoint Object Pin
dabuskol23-Jun-04 1:26
dabuskol23-Jun-04 1:26 
GeneralRe: IEndPoint Object Pin
Heath Stewart23-Jun-04 4:24
protectorHeath Stewart23-Jun-04 4:24 
GeneralHighlight a line that contains a string Pin
clatten22-Jun-04 23:49
clatten22-Jun-04 23:49 
GeneralRe: Highlight a line that contains a string Pin
LongRange.Shooter23-Jun-04 3:20
LongRange.Shooter23-Jun-04 3:20 
Looking at the richtext control in a prototype project I built, it indicates that display.Find() returns an index of the found line of text.

So it may be possible to make use of the display.GetLineFromCharIndex() using the result form Find();

So your final code would be this:
RichTextBox display = new RichTextBox();
 ...
public void SetLine(string textToSelect)
{
     int locate = display.Find(textToSelect);
     int linePos= display.GetLineFromCharIndex(locate);
     this.SetSelectedStyle();
     display.SelectedText = display.Lines[linePos];
}


The approach I took to determine this was to create a blank project.
Add a richtext control.
Create a dummy method in the project so that I can see exposed properties and methods.
Start looking at 'WHAT' for the return type and description of Find();
See what is exposed that deals with lines based on character position.
See what collection might be used for the output of that.

______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
GeneralRe: Highlight a line that contains a string Pin
clatten23-Jun-04 11:44
clatten23-Jun-04 11:44 
GeneralRe: Highlight a line that contains a string Pin
clatten23-Jun-04 21:57
clatten23-Jun-04 21:57 
GeneralRequired permissions cannot be acquired Pin
Daniel Zaharia22-Jun-04 23:25
Daniel Zaharia22-Jun-04 23:25 
GeneralRe: Required permissions cannot be acquired Pin
Jochen Kalmbach [MVP VC++]23-Jun-04 0:44
Jochen Kalmbach [MVP VC++]23-Jun-04 0:44 
GeneralRe: Required permissions cannot be acquired Pin
Daniel Zaharia23-Jun-04 1:37
Daniel Zaharia23-Jun-04 1:37 
GeneralRe: Required permissions cannot be acquired Pin
Jochen Kalmbach [MVP VC++]23-Jun-04 1:57
Jochen Kalmbach [MVP VC++]23-Jun-04 1:57 
GeneralRe: Required permissions cannot be acquired Pin
Heath Stewart23-Jun-04 4:19
protectorHeath Stewart23-Jun-04 4:19 
GeneralRe: Required permissions cannot be acquired Pin
Daniel Zaharia23-Jun-04 4:37
Daniel Zaharia23-Jun-04 4:37 
GeneralRe: Required permissions cannot be acquired Pin
Daniel Zaharia23-Jun-04 2:06
Daniel Zaharia23-Jun-04 2:06 
GeneralRegistration page woes Pin
diptea22-Jun-04 23:18
diptea22-Jun-04 23:18 
GeneralRe: Registration page woes Pin
Colin Angus Mackay22-Jun-04 23:39
Colin Angus Mackay22-Jun-04 23:39 
GeneralTo add a style in datagrid Pin
HowRU22-Jun-04 23:05
HowRU22-Jun-04 23:05 
GeneralRe: To add a style in datagrid Pin
Dave Kreskowiak23-Jun-04 4:05
mveDave Kreskowiak23-Jun-04 4:05 
GeneralA question about VBA and C# Pin
Member 94012522-Jun-04 22:34
Member 94012522-Jun-04 22:34 
GeneralRe: A question about VBA and C# Pin
Heath Stewart23-Jun-04 4:06
protectorHeath Stewart23-Jun-04 4:06 
GeneralQ: Coloring Schemes Pin
yoaz22-Jun-04 22:08
yoaz22-Jun-04 22:08 
GeneralRe: Q: Coloring Schemes Pin
Daniel M. Edwards23-Jun-04 3:02
Daniel M. Edwards23-Jun-04 3:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.