private void dgvPasswordList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { PasswordDetailLogin pl = new PasswordDetailLogin(); PasswordDetail plDetail = new PasswordDetail(); string rowCustomPassword = dgvPasswordList.Rows[e.RowIndex].Cells["CustomPassword"].Value.ToString(); rowID = int.Parse(dgvPasswordList.Rows[e.RowIndex].Cells["ID"].Value.ToString()); rowTitle = dgvPasswordList.Rows[e.RowIndex].Cells["title"].Value.ToString(); rowPassword = dgvPasswordList.Rows[e.RowIndex].Cells["Password"].Value.ToString(); rowCustomPassword = dgvPasswordList.Rows[e.RowIndex].Cells["CustomPassword"].Value.ToString(); if (rowCustomPassword != string.Empty) { pl.ShowDialog(); } else { PasswordDetail.rowID = rowID; plDetail.txtTitle.Text = rowTitle; plDetail.txtPassword.Text = rowPassword; plDetail.txtCustomPassword.Text = rowCustomPassword; plDetail.ShowDialog(); } } catch (Exception ex) { dgvPasswordList.ClearSelection(); } }
private void cntRightMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { clickedItem = e.ClickedItem.Text; cntRightMenu.Visible = false; if (clickedItem.ToLower().Contains("delete")) { var isOk = MessageBox.Show("Are you sure you want to delete?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (isOk == DialogResult.Yes) { p.DeleteData(deletedRow); dgvPasswordList.DataSource = p.GetDataTable(); } } else { PasswordDetailLogin pl = new PasswordDetailLogin(); PasswordDetail plDetail = new PasswordDetail(); int rowInd = dgvPasswordList.SelectedRows[0].Index; string rowCustomPassword = dgvPasswordList.Rows[rowInd].Cells["CustomPassword"].Value.ToString(); rowID = int.Parse(dgvPasswordList.Rows[rowInd].Cells["ID"].Value.ToString()); rowTitle = dgvPasswordList.Rows[rowInd].Cells["title"].Value.ToString(); rowPassword = dgvPasswordList.Rows[rowInd].Cells["Password"].Value.ToString(); rowCustomPassword = dgvPasswordList.Rows[rowInd].Cells["CustomPassword"].Value.ToString(); if (rowCustomPassword != string.Empty) { pl.ShowDialog(); } else { PasswordDetail.rowID = rowID; plDetail.txtTitle.Text = rowTitle; plDetail.txtPassword.Text = rowPassword; plDetail.txtCustomPassword.Text = rowCustomPassword; plDetail.ShowDialog(); } } dgvPasswordList.ClearSelection(); }