a how to question

This is a discussion on a how to question within the C# Programming forums, part of the General Programming Boards category; happy new year all, maybe i am asking this question because i have been away from programming for a couple ...

  1. #1
    budding software engineer luigi40's Avatar
    Join Date
    Jun 2004
    Location
    South Coast UK
    Posts
    61

    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

    Code:
    private void Form1_Load(object sender, System.EventArgs e)
    		{
    			MessageBox.Show("Turtle Commands:	Meaning\n" +
    							"***********************\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", 
    							"Turtle Graphics");
    		
    		}
    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?

    thanks

    Luigi
    You will never know unless you try!

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    8
    Why not use something like the following with the turtles movements shown in the area above the buttons.
    Attached Images Attached Images  

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    1

    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.

    -AJ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21