private void AddTimeBTN_Click(object sender, EventArgs e) { string Date = DTP.Value.ToString("dd/MM/yyyy"); string Time = textBox1.Text; DateTime DT = DateTime.ParseExact((Date + " " + Time), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); if (!checkdoubletimes((Int32)NumHall.Value, DT, Duration)) { AD.CreateDateTime(DT, Title, (Int32)NumHall.Value); DTP.ResetText(); textBox1.Clear(); NumHall.ResetText(); } else { DTP.ResetText(); textBox1.Clear(); NumHall.ResetText(); MessageBox.Show("The given hall is already in use at the given time. Please try again", "Invalid date", MessageBoxButtons.OK, MessageBoxIcon.Error); } }