private void dgViewAllWords_CellContentClick(object sender, DataGridViewCellEventArgs e) { WordBLL updateWord = new WordBLL(); int columnIndex = dgViewAllWords.CurrentCell.ColumnIndex; WordId = int.Parse(dgViewAllWords.CurrentRow.Cells["wordid"].Value.ToString()); DataTable dtAllWords; if (dgViewAllWords.CurrentRow.Cells[columnIndex].Value.ToString() == "Update") { dtAllWords = updateWord.GetAllWords(); txtEnglishWord.Text = dtAllWords.Rows[0][1].ToString(); txtFrenchWord.Text = dtAllWords.Rows[0][2].ToString(); btnAddNewWord.Text = "Update"; } else if (dgViewAllWords.CurrentRow.Cells[columnIndex].Value.ToString() == "Delete") { DialogResult confirmResult = MessageBox.Show("Are you sure to delete this item?", "Confirm Delete", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { updateWord.DeleteWord(); retrieveAllWords(); clearControls(); } } }
public void retrieveAllWords() { WordBLL retrieveAllWord = new WordBLL(); DataTable dtAllWords = retrieveAllWord.GetAllWords(); dgViewAllWords.DataSource = dtAllWords; }
private void Game_Load(object sender, EventArgs e) { wordSetGrpBoxDimension(); loadPlayers(); WordClicked = new WordBLL(); dataTableWords = WordClicked.GetAllWords(); loadEnglishWord(); loadFrenchWord(); player1Timer.Start(); totalTimer.Start(); }