Question: Error on all Input strings ( int y = Convert.ToInt 3 2 ( txtY . Text ) ; ) Code: C## namespace Assignment

Error on all Input strings ("int y = Convert.ToInt32(txtY.Text);")
Code: C##
namespace Assignment_3
{
public partial class Maze : Form
{
/*
* Northeast
*[0,1][0,1]
*[-1,0][0,0][1,0/] Southwest[-1,0][1,0]Northwest
*[0,-1][0,-1]
* Southeast
*/
public Maze()
{
InitializeComponent();
}
private void Maze_Load(object sender, EventArgs e)
{
txtOutput.Text = "You are in a room with an exit to the North, Northeast, Northwest, South, Southeast, Southwest, East, and West.";
txtX.Text ="0";
txtX.Text ="0";
}
private void btnNorth_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(txtX.Text);
int y = Convert.ToInt32(txtY.Text);
if (x ==0 && y ==0)
{
txtOutput.Text = "You are in a room with an exit to the South or Southeast.";
btnNorth.Enabled = false;
btnEast.Enabled = false;
btnSouth.Enabled = true;
btnWest.Enabled = false;
btnNortheast.Enabled = false;
btnSoutheast.Enabled = false;
btnNorthwest.Enabled = false;
btnSouthwest.Enabled = false;
//btnWest.Visible = false;
txtY.Text ="1";
}
else if (x ==0 && y ==-1)
{
txtOutput.Text = "You are in a room with an exit to the North, Northeast, Northwest, South, Southeast, Southwest, East, and West.";
btnNorth.Enabled = true;
btnEast.Enabled = true;
btnSouth.Enabled = true;
btnWest.Enabled = true;
btnNortheast.Enabled = true;
btnSoutheast.Enabled = true;
btnNorthwest.Enabled = true;
btnSouthwest.Enabled = true;
//btnWest.Visible = false;
txtY.Text ="0";
}
}
private void btnSouth_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(txtX.Text);
int y = Convert.ToInt32(txtY.Text);
if (x ==0 && y ==0)
{
txtOutput.Text = "You are in a room with an exit to the North or Northeast.";
btnNorth.Enabled = true;
btnEast.Enabled = false;
btnSouth.Enabled = false;
btnWest.Enabled = false;
btnNortheast.Enabled = false;
btnSoutheast.Enabled = false;
btnNorthwest.Enabled = false;
btnSouthwest.Enabled = false;
txtY.Text ="-1";
}
else if (x ==0 && y ==1)
{
txtOutput.Text = "You are in a room with an exit to the North, Northeast, Northwest, South, Southeast, Southwest, East, and West.";
btnNorth.Enabled = true;
btnEast.Enabled = true;
btnSouth.Enabled = true;
btnWest.Enabled = true;
btnNortheast.Enabled = true;
btnSoutheast.Enabled = true;
btnNorthwest.Enabled = true;
btnSouthwest.Enabled = true;
txtY.Text ="0";
}
}
private void btnEast_Click(object sender, EventArgs e)
{
int x = Convert.ToInt32(txtX.Text);
int y = Convert.ToInt32(txtY.Text);
if (x ==0 && y ==0)
{
txtOutput.Text = "You are in a room with a lever in it and an exit to the West or Southwest.";
btnNorth.Enabled = false;
btnEast.Enabled = false;
btnSouth.Enabled = false;
btnWest.Enabled = true;
btnNortheast.Enabled = false;
btnSoutheast.Enabled = false;
btnNorthwest.Enabled = false;
btnSouthwest.Enabled = false;
btnAction.Visible = true;
btnAction.Text = "Pull Lever?";
txtX.Text ="1";
}
else if (x ==-1 && y ==0)
{
txtOutput.Text = "You are in a room with an exit to the North, Northeast, Northwest, South, Southeast, Southwest, East, and West.";
btnNorth.Enabled = true;
btnEast.Enabled = true;
btnSouth.Enabled = true;
btnWest.Enabled = true;
btnNortheast.Enabled = true;
btnSoutheast.Enabled = true;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!