a how to question
happy new year all, maybe i am asking this question because i have been away from programming for a couple of weeks.
I am designing a program that needs to read in commands from the user, this is the menu
for a console program i would use a switch case structure fed from a Console.ReadLine method to assign the relevant commands as the user types them in etc, however, reading around im wandering whats an efficient way of doing this with the form class which is what im using. I dont really want 8 textboxes, i guess i could use 1 textbox for all eight commands. What would you use for the graphical front end?
private void Form1_Load(object sender, System.EventArgs e)
MessageBox.Show("Turtle Commands: Meaning\n" +
"1 pen up\n" +
"2 pen down\n" +
"3 turn right\n" +
"4 turn left\n" +
"5,X move forward by X spaces\n" +
"6 print array\n" +
"9 end program",
Why not use something like the following with the turtles movements shown in the area above the buttons.
here's what i would do
Use the OnKeyDown event and use a switch....case block to figure out what key is being pressed. Then perform the associated action. Hope that helps.