How to have String or Boolean input parameters
Author: bgood
Creation Date: 10/30/2008 2:22 PM
profile picture

bgood

#1
Hello all,

5.0 is amazing. I have been working through the manual learning how do do various things. The double-input-parameters are very useful, but I find that I want a boolean-parameter. Currently I am using 0/1 as the toggle. It is not pretty, but it works. I would like to have a cleaner way to deal with booleans. I cannot find any discussion how to do string-input-parameters. Can you please help.

Bryce
profile picture

Cone

#2
Strategy Parameters can only be floats or integers, so 0/1 is the right way to boolean.

A simple string input box -
CODE:
Please log in to see this code.
profile picture

bgood

#3
Hello Cone,

First let me apologize in advance because I am very new to C#. I checked the box to add the reference to Microsoft.VisualBasic and added a using Microsoft.VisualBasic to my code, but the only thing recognized is VBcodeProvider. What am I doing wrong?
profile picture

Cone

#4
You don't need the "using" because the method already specified Microsoft.VisualBasic.

Did you insert that code in the Execute method and click the "Run the Strategy" button? Remember, when editing code, you need to compile it to run it. The Compile button only compiles (you may just want to check for syntax errors before executing), and "Run the Strategy" compiles and runs.
profile picture

bgood

#5
So using appears to be like the pascal with statement, allowing for partial-scoped references. "using" is deleted. I added the statement

altSymbol_1 = Microsoft.VisualBasic.Interaction.InputBox("Prompt", "Title", "Default Text", 500, 500);

to the constructor method. The compiler complains that "interaction" does not exist in the namespace "Microsoft.VisualBasic".
profile picture

Eugene

#6
QUOTE:
The compiler complains that "interaction" does not exist in the namespace "Microsoft.VisualBasic".


Check Microsoft.VisualBasic, not something else that looks like - it will give exactly this error.

profile picture

bgood

#7
Thank you. I know that I checked the Microsoft.VisualBasic box, but when I checked again, it was not. I did it again, compiled, and everything runs.

While it would be perfect if this worked like the strategy parameters, at least this works for now and gets me over this hump.

Thank you for your prompt help.
profile picture

Cone

#8
There's a bug in 5.1 with the keeping the References checked. It will be fixed in the next release (5.3).
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).