I just finished chapter 3 of your book (which so far is very good) and I have completed exercise 3 (my code is slightly different to the solution you offer) and whenever I build it I do not get any errors but when I run (F5) the program it seems to open up the windows forms display and a command window and I really have no clue why?
This is my code:
Code:
private void btnEOO_Click(object sender, EventArgs e)
{
int input1;
bool flag;
//Step two
//Input
flag = int.TryParse(txtEvenOrOdd.Text, out input1);
if (flag == false)
{
MessageBox.Show("Please only enter whole numbers", "Input Error");
txtEvenOrOdd.Focus();
return;
}
//Step 3
//Process
if ((input1 % 2) == 0)
//Step 4
//Display
{
MessageBox.Show("The number is even", "Even");
}
else
{
MessageBox.Show("The number is odd", "Odd");
}
}
private void btnClear_Click(object sender, EventArgs e)
{
txtEvenOrOdd.Text = "";
}
private void btnExit_Click(object sender, EventArgs e)
{
Close();
}
I can't see what about the code would cause this to happen and this only occurs when I run this project not any others. The command window that opens alongside the form is empty but does display the projects file path.
I took a screen shot but I can't put it in this post (could be useful to attach images to posts?) by command window I mean the black rectangle that displays if you enter "cmd" in run for example.
I hope thats clear, do you have any idea why this might be happening?