private void btnSubmit_Click(object sender, EventArgs e) { if (connected) { using (UserCreator uc = new UserCreator()) { uc.SetFirstName(txtFname.Text); uc.SetLastName(txtLname.Text); uc.SetMiddleInit(txtDBPassword.Text); uc.SetDbPass(_dbPass); uc.SetDbUser(_dbuserName); uc.Setdb(_db); uc.AddNewUserToDatabase(lstSkills.Items.OfType <string>().ToArray()); lstUser.Items.Clear(); con(); } } else { //Todo: write warning message. } }