Several rookie questions about this solution, as I cannot get it to work. I tried placing this code under a button::click action and then calling the function right after it. This did not work... so where should I place the function so I can call it at a button::click action.
You would place that function in a Scripting Object. In the hierarchy view right mouse click on the root object (usually form1) and choose Insert Scripting Object. A new variables node will appear with a child node called "Untitled Script Object". Give your Script Object a name (myScriptObject) then click on it. In the Script Editor all events will be greyed out but you can copy your function into that screen. Now when you call your function you woudl use:
Hope that helps
That does help. Thank you!