private void btn_add_user_Click(object sender, EventArgs e) { string user_name = tb_userName_user.Text.ToString().Trim(); string name = tb_name_user.Text.ToString().Trim(); string sphone = tb_phone_user.Text.ToString().Trim(); string location = tb_location_user.Text.ToString().Trim(); string dob = dtp_dob_user.Value.ToString("dd/MM/yyyy").Trim(); string password = tb_pass_user.Text.ToString().Trim(); if (isValidString(user_name) && isValidString(name) && isValidString(location) && isValidString(password) && isValidString(sphone)) { int phone = int.Parse(sphone); UserControls userControls = new UserControls(); User user = userControls.SearchUser(user_name, "user"); if (user == null) { user = new User(user_name, name, phone, location, dob, "user", password); userControls = new UserControls(user); bool isAdded = userControls.AddUser(); if (isAdded) { LoadUsers(); MessageBox.Show("User Added."); } else { MessageBox.Show("User can not be Added."); } } else { MessageBox.Show("User Already Exists."); } } else { MessageBox.Show("Please Enter All Info."); } }