I want to change value in SelectedText in Infragistics UltraTextEditor before calling Copy method. However, each time I try to set new value, SelectedText becomes blank. I'm working in C#, Visual Studio 2013.
Here is code snippet:
string textToAlter = this.externalMessageTextBox.SelectedText;
if (textToAlter.Contains("\r\n"))
textToAlter = textToAlter.Replace("\r\n", "\r");
this.externalMessageTextBox.SelectedText = textToAlter; // SelectedText becomes blank
Additional information:
The text to be copied is an HL7 (Health Level 7) message like the one below. It needs carriage return and new line to make it readable as text in UltraTextEditor, but HL7 standard requires segments to be terminated with with carriage return only. I wanted copied text to be formatted per HL7 standard, because users most commonly copy it for pasting in HL7 specific editor or parser.
Here is the example of text message:
MSH|^~\&|LLS|NI|CTI|TEST0001|199712291047||ORU|57341.002|P|2.2
PID|1|111296|111296||Test^Patient|||M||||||||||1000
ORC|RE|R6013121-4^CTI|6013121-4^LLS||||||19971229104734
OBR|1|R6013121-4^CTI|6013121-4^LLS|5763^VITAMIN B12^L|||19951218000000|||||||19951219091841||||||||19971229104736|||F