Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 [RESOLVED] How to find index of line in RichTextBox?

$
0
0
Okay, I've got a RichTextBox that the user enters data into. In this case, multiple lines from a script. I want to auto-detect if a line in the rtb is a line of dialogue in the play, i.e. does it begin with a character's name (I keep the names in a separate list). Detecting that is simple... I loop through the rtb.Lines and compare the beginning of each line to each name in the character array. The problem begins when I find a match... Let's say I want to make the first ten characters of line #7 bold... how? The way I know how to select characters and change the font of that selection depends upon a selection range that deals with absolute character position, not relative to a line number. So, is there an easy way to determine the index of a line, ex: lnie #7 begins at position 87 and ends at position 94? Or better yet, to say select text beginning at line #7, character 0, for 10 characters?

Honestly, it seems like it should be easy to do this... else why supply the .Lines in the first place? But I honestly cannot find it.

For the record, I'm using VS2010 and .NET 4.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>