private void txtUserName_LostFocus(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtUserName.Text)) { // autofill form if username exists instead of prompt error if (data.Select(view.vlogin_users, txtUserName.Text)) { helpers.setProps(view.vlogin_users.Rows[0].ItemArray, props); txtFName.Text = props.FirstName; txtLName.Text = props.LastName; txtUserName.Text = props.UserId; MessageBox.Show("username already exists"); } } }
private void checkRecsExist() { data.Select(view.vlogin_users); // set fields to ReadOnly is no users in db if (view.vlogin_users.Rows.Count == 0) { txtUsername.Enabled = false; txtPassword.Enabled = false; } else { txtUsername.Enabled = true; txtPassword.Enabled = true; } }