B
Beringer
I am using Framework v1.0 (C#).
My question about richtextboxes is:
I have been choosing a location in the text box string doing the following:
....
textbox.SelectionLength = 0;
textbox.SelectionStart = myPos;
....
After setting the position I have been inserting text by calling:
....
textbox.SelectedText = "Testing";
....
I discovered that the new SelectionStart after using SelectedText is: myPos
+ 7. 7 being the length of the selected text inserted. This has worked
well for me but it has been brought to my attention that this might be a bug
in the RichTextBox and I shouldn't rely on this and SelectionStart should
really be myPos after using SelectedText. Is this true?
I find this to be very useful because if I use SelectedText again say:
....
textbox.SelectedText = "NewString";
....
The result would be:
"TestingNewString "
and not
"NewStringTesting"
It seems very natural to move the SelectionStart after using SelectedText,
am I wrong?
Thanks in advance,
Eric
My question about richtextboxes is:
I have been choosing a location in the text box string doing the following:
....
textbox.SelectionLength = 0;
textbox.SelectionStart = myPos;
....
After setting the position I have been inserting text by calling:
....
textbox.SelectedText = "Testing";
....
I discovered that the new SelectionStart after using SelectedText is: myPos
+ 7. 7 being the length of the selected text inserted. This has worked
well for me but it has been brought to my attention that this might be a bug
in the RichTextBox and I shouldn't rely on this and SelectionStart should
really be myPos after using SelectedText. Is this true?
I find this to be very useful because if I use SelectedText again say:
....
textbox.SelectedText = "NewString";
....
The result would be:
"TestingNewString "
and not
"NewStringTesting"
It seems very natural to move the SelectionStart after using SelectedText,
am I wrong?
Thanks in advance,
Eric