Input dialog error!

Tried creating variables inside “Result” of an input dialog and created a string variable but it started producing compiler errors. Then i tried declaring variable in the variable panel as string and it worked fine. why is it doing so , any idea??

When you create the variable at step (Ctrl+K) from inside the InputDialog.Output.Result, it generates the variable in the variable panel (with default type set to GenericValue), and there no exclamation marker (compiler error warning) showing up right next to the Result field value. But the moment you change the variable type (in the variable pane) to meet your requirement the compiler warning marker will appear right away as it falls out of sync. This because the change creates a [type] discrepancy between the variable and the reference in Output.Result. The variable name in the Output.Result field for some reason holds on to the original variable type (genericvalue), and because your variable is now of a different type, you will get a compiler error saying that “the provided expression’s type must exactly match the type…”

This is why the best practice is to create the variable from the variable panel first, and then use it in the Output.Results field inside the InputDialog. This way there is no conflict.