예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            KeyData KP = new KeyData(PNameBox.Text, PasswordBox.Text, LoginBox.Text, URLBox.Text);

            if (KP.IsValid)
            {
                if (nameList.IndexOf(KP.Name) == -1 || renaming)
                {
                    res          = KP;
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    MessageBox.Show(PasswordExistsLabel.Text, ErrorLabel.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(NotValidLabel.Text, ErrorLabel.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void DownButton_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentCell.RowIndex < dataGridView1.Rows.Count - 1)
            {
                KeyData KP = new KeyData(dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString(), dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString(), dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value.ToString(), dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value.ToString());
                dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value = dataGridView1[0, dataGridView1.CurrentCell.RowIndex + 1].Value;
                dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value = dataGridView1[1, dataGridView1.CurrentCell.RowIndex + 1].Value;
                dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value = dataGridView1[2, dataGridView1.CurrentCell.RowIndex + 1].Value;
                dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value = dataGridView1[3, dataGridView1.CurrentCell.RowIndex + 1].Value;

                dataGridView1[0, dataGridView1.CurrentCell.RowIndex + 1].Value = KP.Name;
                dataGridView1[1, dataGridView1.CurrentCell.RowIndex + 1].Value = KP.Password;
                dataGridView1[2, dataGridView1.CurrentCell.RowIndex + 1].Value = KP.Login;
                dataGridView1[3, dataGridView1.CurrentCell.RowIndex + 1].Value = KP.URL;

                dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex + 1];

                KP.Name     = null;
                KP.Password = null;
                KP.Login    = null;
                KP.URL      = null;
                DataChanged();
            }
        }