Click here to Skip to main content
15,747,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone!

I am modifying the Basic Sharp Interpreter for my application, my application is a winforms application and i have imported the classes from BasicSharp into my application and i am able to send code through it and get a response.

I need to get the code to ask questions using a dialog result box when i enter the below code into the interpreter:

result = QUESTION("Do you wish to add a time record today?")

The MessageBox/Dialog Result Box will give yes no answers and depending on the output, it will put either yes or no into the result variable.

The trouble i am having is getting the value in the brackets into the messagebox. Any help on this is much appreciated!

What I have tried:

else if (lastToken == Token.Question)
               string abc = "";

                   abc = vars[lex.Identifier].String;

               //This box of code handles the Question identifier, it takes input from user and sets to the variable
               //Console.Write("Input value: ");
               string input = "";
               DialogResult result = MessageBox.Show(abc, "Confirmation", MessageBoxButtons.YesNo);
               if (result == DialogResult.Yes)
                   input = "Yes";

                   input = "No";

               //string input = Console.ReadLine();
               Value value = new Value(input);
               SetVar(lex.Identifier, value);
               prim = lex.Value;

Richard MacCutchan 7-May-20 7:05am    
What is BasicSharp?
patrickb123 7-May-20 7:06am
Richard MacCutchan 7-May-20 7:15am    
So it is some third party application that very few people will have heard of. You will need to provide some more specific and detailed information before anyone can guess what the code is doing. And your question mentions "getting the value in the brackets into the messagebox.", but I cannot figure out where that is supposed to happen or what value you are referring to.
patrickb123 7-May-20 7:22am    
So the text in the brackets of the question which is: QUESTION("Do you wish to record time today?"), needs to be put into the dialog result text, which in the above code can be seen using the abc variable: DialogResult result = MessageBox.Show(abc, "Confirmation",
Richard MacCutchan 7-May-20 7:25am    
So what is the problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900