So change txt1 to whatever it's an example only. I would not reccomend naming a text field to the name 'text' the default names are txt1, txt2 etc so that was what I used in the example.

Put the code in the OnData is fine as you don't want to execute it until you have the text from your file loaded in.