I have a richtextbox that I paste a HL7 msg into and then harvest the message instance manually from the text, what I would like to do is automate the harvest of this integer to automate the selection process.
example of message:
OBX|1|TX|^13971.8498.Report Text||Examination: Right elbow series
OBX|2|TX|^13971.8498.Report Text
OBX|3|TX|^13971.8498.Report Text||Examination date: February 18, 2011
OBX|4|TX|^13971.8498.Report Text
.......................................
I have the code to remove all the OBX segments after selecting and the msg number 13971.8498 and pasting it into a textbox. This leaves me with a nice report that can be read by the general public.
vb.net Code:
Public Sub removal() Dim obxnum As String = 1 Dim text As String = TxtMsg.Text 'Almost always by 100 it removes everything, 'if there is a better method please advise Do Until obxnum = 100 text = Replace(text, "OBX|" + obxnum + "|TX|^" + TxtOBXState.Text + ".Report Text", "") obxnum = obxnum + 1 'write back Loop text = Replace(text, "||", "") TxtMsg.Text = text End Sub
I would prefer that there be no textbox involved and that upon button click auto select the integer instance and dim it as my string variable within my script to remove the OBX segments.
I know txtbox.Select(10,?)
Now how can I solve for ? being as this number is incremental and will change in string length?
Thanks,
Chad




Reply With Quote
