Esempio n. 1
0
 private void button6_Click(object sender, EventArgs e)
 {
     AddTopic addTopic = new AddTopic();
     addTopic.bodyTopic = this;
     addTopic.ShowDialog();
 }
Esempio n. 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            AddTopic addTopic = new AddTopic();
            addTopic.bodyTopic = this;
            addTopic.labTitle.Text = "修改题目";
            addTopic.topicType.SelectedIndex = Convert.ToInt32(pageCtrl.dg.CurrentRow.Cells[6].Value);
            addTopic.topicCategory.SelectedIndex = Convert.ToInt32(pageCtrl.dg.CurrentRow.Cells[7].Value);
            addTopic.txtContent.Text = Convert.ToString(pageCtrl.dg.CurrentRow.Cells[1].Value);
            addTopic.txtAnswers.Text = Convert.ToString(pageCtrl.dg.CurrentRow.Cells[4].Value);
            addTopic.labTopicId.Text = Convert.ToString(pageCtrl.dg.CurrentRow.Cells[0].Value);

            DataTable dt = topicService.getTopicDetail(Convert.ToInt32(pageCtrl.dg.CurrentRow.Cells[0].Value)).Tables[0];
            foreach (DataRow dr in dt.Rows)
            {
                int total = addTopic.dg.Rows.Count;
                DataGridViewRow row = new DataGridViewRow();
                DataGridViewTextBoxCell cell1 = new DataGridViewTextBoxCell();
                cell1.Value = dr[1];
                row.Cells.Add(cell1);
                DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell();
                cell2.Value = dr[2];
                row.Cells.Add(cell2);
                addTopic.dg.Rows.Add(row);
            }

            addTopic.ShowDialog();
        }