private void button1_Click(object sender, EventArgs e) { int ID; if (!int.TryParse(addIDTextbox.Text, out ID)) { MessageBox.Show("ID must contain numbers only", "ID not a number", MessageBoxButtons.OK, MessageBoxIcon.Error); } StudentProfile studentProfile = new StudentProfile(ID, addBarcodeTextbox.Text, addNameTextbox.Text); General.AddProfileToDatabase(studentProfile, databasePath); addIDTextbox.Text = ""; addBarcodeTextbox.Text = ""; addNameTextbox.Text = ""; }