If you pass a retrieve_name to textBoxDialog(), along with the TB_RETRIEVE_INIT flag, then you can take advantage of dialog box retrieval to do the heavy lifting for you. In fact, this will allow you to use F7/F8 to flip through previous results you input:
result := textBoxDialog("I have a question", // Form caption
TB_RETRIEVE_INIT, // Flags
0, // Use default textbox width
"", // Help item
"42,Cancel", // Buttons and captions
"the_answer_to_life_the_universe_and_everything", // Retrieve Name
"What is the answer:");