private void SelectRow() { if (dataGrid.SelectedRows.Count == 1) { var row = dataGrid.SelectedRows[0]; IdText.Text = row.Cells["ID"].Value.ToString(); NameText.Text = row.Cells["Name"].Value.ToString(); PriceText.Text = row.Cells["Price"].Value.ToString(); CurrentAmountText.Text = row.Cells["CurrentCount"].Value.ToString(); RequiredAmountText.Text = row.Cells["RequiredCount"].Value.ToString(); //QuantityText.Text = row.Cells["Quantity"].Value.ToString(); string type = row.Cells["TypeName"].Value.ToString(); ITypeCombo.SelectedIndex = ITypeCombo.FindStringExact(type); saveBtn.Text = "Update"; } }
private void StoreItemForm_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'restaurantManagementDataSet.StoreItemType' table. You can move, or remove it, as needed. this.storeItemTypeTableAdapter.Fill(this.restaurantManagementDataSet.StoreItemType); IdText.Enabled = false; CurrentAmountText.Enabled = false; ClearData(); if (storeType != null) { dataGrid.DataSource = controller.ViewItemsType(storeType); ITypeCombo.SelectedIndex = ITypeCombo.FindStringExact(storeType.Name); searchTextBox.Text = storeType.Name; } else { ITypeCombo.SelectedIndex = -1; dataGrid.DataSource = controller.ViewAll(); } dataGrid.Columns["ID"].Width = 80; dataGrid.Columns["Name"].Width = 200; }