private void txtUserId_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { LibrarianDS.userRow userRow = findByUserId(Convert.ToInt32(txtUserId.Text)); // if there is user with given id, show user's attributes in text controls and enable rent button if (userRow != null) { PopulateUserFields(userRow); txtUserId.SelectAll(); btnRent.Enabled = true; } // clean the text controls for user, disable rent button else { txtSurname.Text = ""; txtName.Text = ""; txtPhone.Text = ""; txtEmail.Text = ""; btnRent.Enabled = false; } } }
/* * Populates user fields with data from userRow */ private void PopulateUserFields(LibrarianDS.userRow userRow) { txtUserId.Text = userRow.id.ToString(); txtSurname.Text = userRow.surname; txtName.Text = userRow.name; txtPhone.Text = userRow.phone; txtEmail.Text = userRow.email; }
public frmRent(LibrarianDS.rentRow rentRow) { InitializeComponent(); this.rentRow = rentRow; this.bookRow = rentRow.tbl_bookRow; this.userRow = rentRow.userRow; btnRent.Text = "Razduži"; btnRent.Enabled = true; }