private void SelectRow() { if (dataGrid.SelectedRows.Count == 1) { var row = dataGrid.SelectedRows[0]; IdText.Text = row.Cells["ID"].Value.ToString(); UsernameText.Text = row.Cells["Username"].Value.ToString(); EmailText.Text = row.Cells["Email"].Value.ToString(); FNameText.Text = row.Cells["FristName"].Value.ToString(); LNameText.Text = row.Cells["LastName"].Value.ToString(); PasswordText.Text = row.Cells["Password"].Value.ToString(); string type = row.Cells["TypeName"].Value.ToString(); UTypeCombo.SelectedIndex = UTypeCombo.FindStringExact(type); saveBtn.Text = "Update"; } }
private void UserForm_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'restaurantManagementDataSet.UserType' table. You can move, or remove it, as needed. this.userTypeTableAdapter.Fill(this.restaurantManagementDataSet.UserType); IdText.Enabled = false; ClearData(); if (userType != null) { dataGrid.DataSource = controller.ViewUsersType(userType); UTypeCombo.SelectedIndex = UTypeCombo.FindStringExact(userType.Name); searchTextBox.Text = userType.Name; } else { dataGrid.DataSource = controller.ViewAll(); } dataGrid.Columns["ID"].Width = 50; dataGrid.Columns["Email"].Width = 150; dataGrid.Columns["Password"].Visible = false; }