Software Designs Fundamentals
Software Designs Fundamentals
Answer :
Produce the program design language algorithms for the following:
{
if (Path.GetExtension(newFile.FileName) == ".txt") //checks that you
entered .txt extension, and then creates a new file
{
File.Create(newFile.FileName);
}
else //if extension is something different than .txt it's going to show
the message box
{
MessageBox.Show("File incorrect format or dialog cancelled",
"Error 001", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
Task A 3 :Specify any error handling needed to trap errors in the booking
screen, file creation and opening an existing file algorithms.
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
try
{
//checking that date is in format "dd/MM/yyyy"
result = DateTime.ParseExact(textBox2.Text, "dd/MM/yyyy", provider);
...
}
catch (FormatException) //if date is not in format that we gave it then it
shows the message box
{
MessageBox.Show("Invalid Date", "Error 004", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}