The code below is in MainFrame.cs and it opens and checks the MovieForm.cs. I want to check if a entered movie title already exist, before a new movie is added to a list. But the problem is, if the title already exist and the messagebox appears, then the MovieForm.cs is already closed and all other data gone and there is no possibilities for the user to change the title to another one! Could this be done in some other way that isn't to complicated? Is there a way to stop the closing of the form? Thanks!
private void btnNewMovie_Click(object sender, EventArgs e)
{
movieForm = new MovieForm();
if (movieForm.ShowDialog() == DialogResult.OK)
{
if (!movieManager.GetMovieFromList(index).Split(',') [0].Equals(movieForm.GetTitle))
{
movieManager.AddNewMovieToMediaLibrary(movieForm.GetNewMovie); // Anropar properties i objektet movieManager
UppdateListboxOfMovies();
}
else
{
MessageBox.Show("Det finns redan en film med titeln " + movieManager.GetMovieFromList(index).Split(',')[0], "Ooops!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}