private void Create_Click(object sender, EventArgs e) { int module; int panelsmade; int.TryParse(Module.Text, out module); if (!int.TryParse(Module.Text, out module)) { MessageBox.Show("Module is a number only field"); return; } int.TryParse(PanelsMade.Text, out panelsmade); if (!int.TryParse(PanelsMade.Text, out panelsmade)) { MessageBox.Show("Panels Made is a number only field"); return; } string name = MachineNames.SelectedItem.ToString(); MessageBox.Show(manager.addPart(MachineNames.SelectedItem.ToString(), module, PartNo.Text.ToString(), panelsmade)); }