示例#1
0
 private void addAnswerButton_Click(object sender, EventArgs e)
 {
     VKAnswerEdit edit = new VKAnswerEdit();
     DialogResult res = edit.ShowDialog();
     if (res == DialogResult.OK)
     {
         vkAnswerList.dataTable.Rows.Add(edit.answerInfo.text, edit.answerInfo.humanValue, edit.answerInfo.androidValue);
         vkAnswerList.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
         vkAnswerList.Refresh();
     }
 }
示例#2
0
        private void editAnswerButton_Click(object sender, EventArgs e)
        {
            Database.VKAnswerInfo info = vkAnswerList.getCurrentAnswerInfo();
            if (info == null)
            {
                MessageBox.Show("Нечего редактировать", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            VKAnswerEdit edit = new VKAnswerEdit();
            edit.answerInfo = info;
            DialogResult res = edit.ShowDialog();
            if (res == DialogResult.OK)
            {
                vkAnswerList.dataTable.Rows[vkAnswerList.selectedIndex()]["TEXT"] = edit.answerInfo.text;
                vkAnswerList.dataTable.Rows[vkAnswerList.selectedIndex()]["HUMAN"] = edit.answerInfo.humanValue;
                vkAnswerList.dataTable.Rows[vkAnswerList.selectedIndex()]["ANDROID"] = edit.answerInfo.androidValue;
                vkAnswerList.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
                vkAnswerList.Refresh();
            }
        }