Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
QuestionRichTextBox and hidden Text Pin
Beringer1-Feb-06 5:51
Beringer1-Feb-06 5:51 
AnswerRe: RichTextBox and hidden Text Pin
Beringer1-Feb-06 7:52
Beringer1-Feb-06 7:52 
GeneralRe: RichTextBox and hidden Text Pin
Beringer1-Feb-06 8:00
Beringer1-Feb-06 8:00 
GeneralRe: RichTextBox and hidden Text Pin
mav.northwind1-Feb-06 9:39
mav.northwind1-Feb-06 9:39 
GeneralRe: RichTextBox and hidden Text Pin
Beringer1-Feb-06 11:08
Beringer1-Feb-06 11:08 
GeneralRe: RichTextBox and hidden Text Pin
mav.northwind1-Feb-06 22:53
mav.northwind1-Feb-06 22:53 
GeneralRe: RichTextBox and hidden Text Pin
Beringer2-Feb-06 7:49
Beringer2-Feb-06 7:49 
GeneralRe: RichTextBox and hidden Text Pin
Beringer2-Feb-06 19:53
Beringer2-Feb-06 19:53 
Ok, thanks again for the input.

I have looked at what is going on and still believe I'm doing things right (probably wrong since it doesn't work, but oh well!).

I created a little test app to do what you did and was able to create the issue I'm having. If you don't mind please try:

Create an form with richTextBox1 and button1 objects.
Use the code below:

        private void button1_Click(object sender, EventArgs e)<br />
        {<br />
            int index = this.richTextBox1.Find("hidden2",<br />
                            RichTextBoxFinds.MatchCase | RichTextBoxFinds.NoHighlight);<br />
            this.richTextBox1.Select(0, index);<br />
            int temp = this.richTextBox1.SelectionStart;<br />
            int temp2 = this.richTextBox1.SelectionLength;<br />
            this.richTextBox1.SelectedText = "Eric";<br />
        }<br />
<br />
        private void Form1_Load(object sender, EventArgs e)<br />
        {<br />
            this.richTextBox1.SelectedRtf = @"{\rtf1\ansi te\v hidden1\v0st1\par}";<br />
            this.richTextBox1.SelectedRtf = @"{\rtf1\ansi te\v hidden2\v0st2\par}";<br />
            //this.richTextBox1.SelectedRtf = @"{\rtf1\ansi\v hidden1\v0test1\par}";<br />
            //this.richTextBox1.SelectedRtf = @"{\rtf1\ansi\v hidden2\v0test2\par}";<br />
        }<br />

Now if you run the app with the first two lines of SelectedRtf statements (basically like your example) and run the app the selection process in the button click method works well; the resulting text in the RTB is: "Ericst2".
Now if you use the other two lines of SelectedRtf statemsnt (basically what I'm doing) you will find the Select doesn't work. And behaves like I mentioned and the RTB shows: "test1Erictest2." Note the SelectionStart and SelectionLength properties don't match what was sent to Select.

Thanks,
Eric
GeneralRe: RichTextBox and hidden Text Pin
mav.northwind2-Feb-06 22:33
mav.northwind2-Feb-06 22:33 
GeneralRe: RichTextBox and hidden Text Pin
Beringer3-Feb-06 4:25
Beringer3-Feb-06 4:25 
Questionreference exe assembly in visual studio Pin
alexrait11-Feb-06 5:37
alexrait11-Feb-06 5:37 
AnswerRe: reference exe assembly in visual studio Pin
Colin Angus Mackay1-Feb-06 5:49
Colin Angus Mackay1-Feb-06 5:49 
GeneralRe: reference exe assembly in visual studio Pin
alexrait11-Feb-06 5:53
alexrait11-Feb-06 5:53 
GeneralRe: reference exe assembly in visual studio Pin
Dave Kreskowiak1-Feb-06 7:02
mveDave Kreskowiak1-Feb-06 7:02 
GeneralRe: reference exe assembly in visual studio Pin
alexrait11-Feb-06 8:15
alexrait11-Feb-06 8:15 
GeneralRe: reference exe assembly in visual studio Pin
Dave Kreskowiak1-Feb-06 9:12
mveDave Kreskowiak1-Feb-06 9:12 
GeneralRe: reference exe assembly in visual studio Pin
mav.northwind1-Feb-06 9:47
mav.northwind1-Feb-06 9:47 
AnswerRe: reference exe assembly in visual studio Pin
Dave Kreskowiak1-Feb-06 5:51
mveDave Kreskowiak1-Feb-06 5:51 
AnswerRe: reference exe assembly in visual studio Pin
Daniel Grunwald1-Feb-06 6:32
Daniel Grunwald1-Feb-06 6:32 
GeneralRe: reference exe assembly in visual studio Pin
alexrait11-Feb-06 6:36
alexrait11-Feb-06 6:36 
QuestionLine number and filenames? Pin
Brian R1-Feb-06 5:18
Brian R1-Feb-06 5:18 
AnswerRe: Line number and filenames? Pin
leppie1-Feb-06 11:50
leppie1-Feb-06 11:50 
QuestionHow can i hit the lines in Compact Framework? Pin
pmasknguyen1-Feb-06 5:05
pmasknguyen1-Feb-06 5:05 
JokeI'm beginner in C# and need a help Pin
Dr.Sammer1-Feb-06 5:04
Dr.Sammer1-Feb-06 5:04 
GeneralRe: I'm beginner in C# and need a help Pin
Dan Neely1-Feb-06 5:35
Dan Neely1-Feb-06 5:35 

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.