Пример #1
0
        private void btn_search_modify_Click(object sender, EventArgs e)
        {
            int size = data_grid_view_search_result.Columns.Count + 1;//plus 1 due to start assigning value not starting with 0

            string[] info = new string[size];

            //making sure only one row is selected to modify
            if (data_grid_view_search_result.SelectedRows.Count == 1)
            {
                foreach (DataGridViewRow r in data_grid_view_search_result.SelectedRows)
                {
                    for (int i = 0; i < r.Cells.Count; i++)
                    {
                        info[i] = r.Cells[i].Value.ToString();//extracting the selected row info into an array
                    }
                }

                info[size - 1] = accountType;//to add the account type to the last value in the array that contains the record

                ModifyOptionForms modify = new ModifyOptionForms(info);
                modify.Show();
            }
            else //if the user has not selected a row
            {
                MessageBox.Show("Make sure to select a row first!");
            }
        }
Пример #2
0
        private void btn_viewpassword_modify_Click(object sender, EventArgs e)
        {
            int size = data_grid_ViewPassword.Columns.Count + 1;

            string[] info = new string[size];

            //to make sure that the password is encrypted when modify button is pressed
            if (btn_viewpassword_revealpasswords.Text == "Hide Passwords")
            {
                btn_viewpassword_revealpasswords_Click(sender, e);
            }

            //making sure only one row is selected to modify
            if (data_grid_ViewPassword.SelectedRows.Count == 1)
            {
                foreach (DataGridViewRow r in data_grid_ViewPassword.SelectedRows)
                {
                    for (int i = 0; i < r.Cells.Count; i++)
                    {
                        info[i] = r.Cells[i].Value.ToString();//extracting the selected row info into an array
                    }
                }

                info[size - 1] = accountType;

                ModifyOptionForms modify = new ModifyOptionForms(info);
                modify.Show();
            }
            else //if the user has not selected a row
            {
                MessageBox.Show("Make sure to select a row first!");
            }
        }