private void btSetupApply_Click(object sender, System.EventArgs e) { try { if (cbSetupBegin.SelectedIndex == -1 || cbSetupFinish.SelectedIndex == -1) { MessageBox.Show("Not enough imformations","Imformation"); } else { Database mydatabase = new Database(); string h = cbSetupFinish.Text; string[] hour = h.Split(new char[] {' '}); int a = mydatabase.setTimeStart(cbSetupBegin.SelectedIndex); int b = mydatabase.setTimeFinish(int.Parse(hour[0].ToString())); if (a == 1 && b == 1) { MessageBox.Show("Saved succeessful! ", "Informations"); } } } catch { } }