private void CreateMachine_Click(object sender, EventArgs e) { maneger.UpdateAll(); //MessageBox.Show("The data was upadated"); AddMachine win = new AddMachine(); win.ShowDialog(); string machinename = win.Machinename; if (maneger.addMachine(machinename, 0) && machinename != null) { MessageBox.Show("Machine was successful created"); } else { DialogResult dialog = MessageBox.Show("Machine allready exist, try again?", "Try again", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { CreateMachine_Click(sender, e); } } }